From 0a6e0958c03e41c87b15557b6f407874f20c2f8d Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:39:55 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1157642 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- khangman/khangman/fontchecker.cpp | 8 +- khangman/khangman/fontchecker.h | 2 +- khangman/khangman/khangman.cpp | 112 ++++++++-------- khangman/khangman/khangman.h | 18 +-- khangman/khangman/khangmanview.cpp | 264 ++++++++++++++++++------------------- khangman/khangman/khangmanview.h | 42 +++--- khangman/khangman/khnewstuff.cpp | 8 +- khangman/khangman/khnewstuff.h | 4 +- khangman/khangman/main.cpp | 4 +- khangman/khangman/timer.cpp | 16 +-- khangman/khangman/timer.h | 2 +- 11 files changed, 240 insertions(+), 240 deletions(-) (limited to 'khangman') diff --git a/khangman/khangman/fontchecker.cpp b/khangman/khangman/fontchecker.cpp index 684afaaa..55e18601 100644 --- a/khangman/khangman/fontchecker.cpp +++ b/khangman/khangman/fontchecker.cpp @@ -7,16 +7,16 @@ * (at your option) any later version. * ***************************************************************************/ -#include -#include +#include +#include #include #include "fontchecker.h" -bool fontChecker::checkInstalled(const QFont &font, const QString &fontPath) +bool fontChecker::checkInstalled(const TQFont &font, const TQString &fontPath) { - QFontInfo fi(font); + TQFontInfo fi(font); // Works with Steve may need some tweaking to work with other fonts if (!fi.exactMatch()) { diff --git a/khangman/khangman/fontchecker.h b/khangman/khangman/fontchecker.h index b8b60b6f..a65c95e9 100644 --- a/khangman/khangman/fontchecker.h +++ b/khangman/khangman/fontchecker.h @@ -15,7 +15,7 @@ class QFont; class fontChecker { public: - static bool checkInstalled(const QFont &font, const QString &fontPath); + static bool checkInstalled(const TQFont &font, const TQString &fontPath); }; #endif diff --git a/khangman/khangman/khangman.cpp b/khangman/khangman/khangman.cpp index 05396587..0b14829e 100644 --- a/khangman/khangman/khangman.cpp +++ b/khangman/khangman/khangman.cpp @@ -26,10 +26,10 @@ #include "timer.h" #include "khnewstuff.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -74,30 +74,30 @@ KHangMan::~KHangMan() void KHangMan::setupActions() { // Game->New - KAction *action = new KAction(i18n("&New"), "filenew", CTRL+Key_N , m_view, SLOT(slotNewGame()), actionCollection(), "file_new"); + KAction *action = new KAction(i18n("&New"), "filenew", CTRL+Key_N , m_view, TQT_SLOT(slotNewGame()), actionCollection(), "file_new"); action->setToolTip(i18n( "Play with a new word" )); // Game->Get Words in New Language - new KAction( i18n("&Get Words in New Language..."), "knewstuff", CTRL+Key_G, this, SLOT( slotDownloadNewStuff() ), actionCollection(), "downloadnewstuff" ); + new KAction( i18n("&Get Words in New Language..."), "knewstuff", CTRL+Key_G, this, TQT_SLOT( slotDownloadNewStuff() ), actionCollection(), "downloadnewstuff" ); - KStdAction::quit(this, SLOT(slotQuit()), actionCollection()); + KStdAction::quit(this, TQT_SLOT(slotQuit()), actionCollection()); m_levelAction = new KSelectAction(i18n("Le&vel"), 0, actionCollection(), "combo_level"); m_levelAction->setToolTip(i18n( "Choose the level" )); m_levelAction->setWhatsThis(i18n( "Choose the level of difficulty" )); - connect(m_levelAction, SIGNAL(activated(int)), this, SLOT(slotChangeLevel(int))); + connect(m_levelAction, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotChangeLevel(int))); // Action for selecting language. m_languageAction = new KSelectAction(i18n("&Language"), 0, actionCollection(), "languages"); m_languageAction->setItems(m_languageNames); m_languageAction->setCurrentItem(m_languages.findIndex(Prefs::selectedLanguage())); - connect(m_languageAction, SIGNAL(activated(int)), this, SLOT(slotChangeLanguage(int))); + connect(m_languageAction, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotChangeLanguage(int))); - KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); + KStdAction::preferences(this, TQT_SLOT(optionsPreferences()), actionCollection()); // Mode. Currently hard coded into Sea and Desert themes. - QStringList modes; - m_modeAction = new KSelectAction(i18n("L&ook"), 0, this, SLOT(slotChangeMode()), actionCollection(), "combo_mode"); + TQStringList modes; + m_modeAction = new KSelectAction(i18n("L&ook"), 0, this, TQT_SLOT(slotChangeMode()), actionCollection(), "combo_mode"); modes += i18n("&Sea Theme"); modes += i18n("&Desert Theme"); m_modeAction->setItems(modes); @@ -120,7 +120,7 @@ void KHangMan::setupStatusbar() // FIXME: Make this into a slot? -void KHangMan::changeStatusbar(const QString& text, int id) +void KHangMan::changeStatusbar(const TQString& text, int id) { statusBar()->changeItem(text, id); } @@ -191,11 +191,11 @@ void KHangMan::setLanguages() m_languageNames.clear(); m_sortedNames.clear(); //the program scans in khangman/data/ to see what languages data is found - QStringList mdirs = KGlobal::dirs()->findDirs("data", "khangman/data/"); + TQStringList mdirs = KGlobal::dirs()->findDirs("data", "khangman/data/"); if (mdirs.isEmpty()) return; - for (QStringList::Iterator it =mdirs.begin(); it !=mdirs.end(); ++it ) { - QDir dir(*it); - m_languages += dir.entryList(QDir::Dirs, QDir::Name); + 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.find(".")); m_languages.remove(m_languages.find("..")); } @@ -207,7 +207,7 @@ void KHangMan::setLanguages() return; //find duplicated entries in KDEDIR and KDEHOME - QStringList temp_languages; + TQStringList temp_languages; for (uint i=0; i1) { temp_languages.append(m_languages[i]); @@ -226,17 +226,17 @@ void KHangMan::setLanguages() KConfig *config=kapp->config(); config->setGroup("KNewStuffStatus"); for (uint i=0; ireadEntry(tmp)) - config->writeEntry(tmp, QDate::currentDate().toString(Qt::ISODate)); + config->writeEntry(tmp, TQDate::currentDate().toString(Qt::ISODate)); } // We look in $KDEDIR/share/locale/all_languages from // kdelibs/kdecore/all_languages to find the name of the country // corresponding to the code and the language the user set. KConfig entry(locate("locale", "all_languages")); - const QStringList::ConstIterator itEnd = m_languages.end(); - for (QStringList::Iterator it = m_languages.begin(); + const TQStringList::ConstIterator itEnd = m_languages.end(); + for (TQStringList::Iterator it = m_languages.begin(); it != m_languages.end(); ++it) { entry.setGroup(*it); if (*it == "sr") @@ -283,18 +283,18 @@ void KHangMan::setLevel() void KHangMan::loadLevels() { //build the Level combobox menu dynamically depending of the data for each language - levels.clear();//initialize QStringList levels + levels.clear();//initialize TQStringList levels KStandardDirs *dirs = KGlobal::dirs(); - QStringList mfiles = dirs->findAllResources("data","khangman/data/" + Prefs::selectedLanguage() + "/*.kvtml"); + TQStringList mfiles = dirs->findAllResources("data","khangman/data/" + Prefs::selectedLanguage() + "/*.kvtml"); bool levelBool = false; if (!mfiles.isEmpty()) { - for (QStringList::Iterator it = mfiles.begin(); it != mfiles.end(); ++it ) { - QFile f( *it); + for (TQStringList::Iterator it = mfiles.begin(); it != mfiles.end(); ++it ) { + TQFile f( *it); //find the last / in the file name int location = f.name().findRev("/"); //strip the string to keep only the filename and not the path - QString mString = f.name().right(f.name().length()-location-1); + TQString mString = f.name().right(f.name().length()-location-1); if (mString == Prefs::levelFile()) levelBool = true; mString = mString.left(mString.length()-6); @@ -307,7 +307,7 @@ void KHangMan::loadLevels() // Sort easy, medium, hard at bottom, with the other categories at the top levels.sort(); - QString replace[3] = { "Easy", "Medium", "Hard" }; + TQString replace[3] = { "Easy", "Medium", "Hard" }; for ( int i = 0; i < 3; ++i ) { if ( levels.findIndex( replace[i] ) > -1 ) @@ -318,10 +318,10 @@ void KHangMan::loadLevels() } //find duplicated entries in KDEDIR and KDEHOME - QString last; - for ( QStringList::Iterator it = levels.begin(); it != levels.end(); ) + TQString last; + for ( TQStringList::Iterator it = levels.begin(); it != levels.end(); ) { - QStringList::Iterator it2 = it++; + TQStringList::Iterator it2 = it++; if (*it2 == last) { // remove duplicate @@ -343,14 +343,14 @@ void KHangMan::loadLevels() currentLevel =0; Prefs::writeConfig(); } - QStringList translatedLevels; - for (QStringList::Iterator it = levels.begin(); it != levels.end(); ++it ) + TQStringList translatedLevels; + for (TQStringList::Iterator it = levels.begin(); it != levels.end(); ++it ) translatedLevels+=i18n((*it).utf8()); m_levelAction->setItems(translatedLevels); m_levelAction->setCurrentItem(Prefs::currentLevel()); setLevel(); - QString m_lstring = translatedLevels[currentLevel].utf8(); + TQString m_lstring = translatedLevels[currentLevel].utf8(); m_lstring.replace(0, 1, m_lstring.left(1).upper()); changeStatusbar(m_lstring, IDS_LEVEL); } @@ -380,7 +380,7 @@ void KHangMan::optionsPreferences() Timer *m_timer = new Timer(); dialog->addPage(m_timer, i18n("Timers"), "clock"); - connect(dialog, SIGNAL(settingsChanged()), this, SLOT(updateSettings())); + connect(dialog, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(updateSettings())); dialog->show(); } @@ -420,13 +420,13 @@ void KHangMan::loadLangToolBar() m_allData.clear(); if (!m_noSpecialChars) { - QString myString=QString("khangman/%1.txt").arg(Prefs::selectedLanguage()); - QFile myFile; + TQString myString=TQString("khangman/%1.txt").arg(Prefs::selectedLanguage()); + TQFile myFile; myFile.setName(locate("data", myString)); // Let's look in local KDEHOME dir then if (!myFile.exists()) { - QString myString=QString("khangman/data/%1/%1.txt") + TQString myString=TQString("khangman/data/%1/%1.txt") .arg(Prefs::selectedLanguage()) .arg(Prefs::selectedLanguage()); myFile.setName(locate("data",myString)); @@ -434,7 +434,7 @@ void KHangMan::loadLangToolBar() } if (!myFile.exists()) { - QString mString=i18n("File $KDEDIR/share/apps/khangman/%1.txt not found;\n" + TQString mString=i18n("File $KDEDIR/share/apps/khangman/%1.txt not found;\n" "check your installation.").arg(Prefs::selectedLanguage()); KMessageBox::sorry( this, mString, i18n("Error") ); @@ -443,20 +443,20 @@ void KHangMan::loadLangToolBar() update(); // We open the file and store info into the stream... - QFile openFileStream(myFile.name()); + TQFile openFileStream(myFile.name()); openFileStream.open(IO_ReadOnly); - QTextStream readFileStr(&openFileStream); - readFileStr.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream readFileStr(&openFileStream); + readFileStr.setEncoding(TQTextStream::UnicodeUTF8); // m_allData contains all the words from the file // FIXME: Better name - m_allData = QStringList::split("\n", readFileStr.read(), true); + m_allData = TQStringList::split("\n", readFileStr.read(), true); openFileStream.close(); for (int i=0; i<(int) m_allData.count(); i++) secondToolbar->insertButton (charIcon(m_allData[i].at(0)), i, - SIGNAL( clicked() ), this, - SLOT( slotPasteChar()), true, + TQT_SIGNAL( clicked() ), this, + TQT_SLOT( slotPasteChar()), true, i18n("Inserts the character %1").arg(m_allData[i]), i+1 ); } @@ -477,34 +477,34 @@ void KHangMan::slotPasteChar() m_view->enterLetter(m_allData[charBut->id()]); } -QString KHangMan::charIcon(const QChar & c) +TQString KHangMan::charIcon(const TQChar & c) { ///Create a name and path for the icon - QString s = locateLocal("icon", "char" + QString::number(c.unicode()) + ".png"); + TQString s = locateLocal("icon", "char" + TQString::number(c.unicode()) + ".png"); - QRect r(4, 4, 120, 120); + TQRect r(4, 4, 120, 120); ///A font to draw the character with - QFont font; + TQFont font; font.setFamily( "Sans Serif" ); font.setPointSize(96); - font.setWeight(QFont::Normal); + font.setWeight(TQFont::Normal); ///Create the pixmap - QPixmap pm(128, 128); + TQPixmap pm(128, 128); pm.fill(Qt::white); - QPainter p(&pm); + TQPainter p(&pm); p.setFont(font); p.setPen(Qt::black); - p.drawText(r, Qt::AlignCenter, (QString) c); + p.drawText(r, Qt::AlignCenter, (TQString) c); ///Create transparency mask - QBitmap bm(128, 128); + TQBitmap bm(128, 128); bm.fill(Qt::color0); - QPainter b(&bm); + TQPainter b(&bm); b.setFont(font); b.setPen(Qt::color1); - b.drawText(r, Qt::AlignCenter, (QString) c); + b.drawText(r, Qt::AlignCenter, (TQString) c); ///Mask the pixmap pm.setMask(bm); diff --git a/khangman/khangman/khangman.h b/khangman/khangman/khangman.h index b7832db5..7c47711a 100644 --- a/khangman/khangman/khangman.h +++ b/khangman/khangman/khangman.h @@ -67,7 +67,7 @@ public: @param text the text that will be written in the statusbar @param id the label in which the text will be written */ - void changeStatusbar(const QString& text, int id); + void changeStatusbar(const TQString& text, int id); ///Action that sets up the Language menu KSelectAction *m_languageAction; @@ -76,9 +76,9 @@ public: void setLanguages(); ///Translated names of languages - QStringList m_languageNames; + TQStringList m_languageNames; ///Language codes of available languages - QStringList m_languages; + TQStringList m_languages; ///Display the correct messages in the statusbar void setMessages(); @@ -90,16 +90,16 @@ public: void setupStatusbar(); ///Selected language - QString selectedLanguage; + TQString selectedLanguage; ///Translated and sorted names of languages - QStringList m_sortedNames; + TQStringList m_sortedNames; ///the different data files in each language dir - QStringList levels; + TQStringList levels; ///Current level ID uint currentLevel; ///hold the current level - QString levelString; + TQString levelString; ///At start, restore settings from config file and apply them void loadSettings(); @@ -115,7 +115,7 @@ public: void loadLangToolBar(); ///Create a png image with the argument (special character) and return the path to this png image - QString charIcon(const QChar &); + TQString charIcon(const TQChar &); public slots: ///When the langugae is changed in the Language menu @@ -156,7 +156,7 @@ private: bool m_noSpecialChars; // Contains all the words that are read from the data file. - QStringList m_allData; + TQStringList m_allData; ///Instance of an advanced page of the config dialog advanced *mAdvanced; diff --git a/khangman/khangman/khangmanview.cpp b/khangman/khangman/khangmanview.cpp index f53a7f99..8fc5bcc5 100644 --- a/khangman/khangman/khangmanview.cpp +++ b/khangman/khangman/khangmanview.cpp @@ -25,15 +25,15 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //project headers #include "prefs.h" @@ -42,23 +42,23 @@ KHangManView::KHangManView(KHangMan*parent, const char *name) - : QWidget(parent, name, WStaticContents | WNoAutoErase) + : TQWidget(parent, name, WStaticContents | WNoAutoErase) { khangman = parent; // The widget for entering letters. m_letterInput = new KLineEdit( this, "charWrite" ); - m_letterInput->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType) 1, - (QSizePolicy::SizeType) 0, + m_letterInput->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType) 1, + (TQSizePolicy::SizeType) 0, 0, 0, m_letterInput->sizePolicy().hasHeightForWidth() ) ); m_letterInput->setMaxLength( 1 ); - m_letterInput->setAlignment( int( QLineEdit::AlignHCenter ) ); + m_letterInput->setAlignment( int( TQLineEdit::AlignHCenter ) ); // Press this button to enter a letter (or press enter) m_guessButton = new KPushButton( this, "guessButton" ); - m_guessButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType) 1, - (QSizePolicy::SizeType) 0, + m_guessButton->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType) 1, + (TQSizePolicy::SizeType) 0, 0, 0, m_guessButton->sizePolicy().hasHeightForWidth() ) ); m_guessButton->setAutoMask( true ); @@ -68,7 +68,7 @@ KHangManView::KHangManView(KHangMan*parent, const char *name) // Get background from config file - default is sea loadAnimation(); - setMinimumSize( QSize( 660, 370 ) ); + setMinimumSize( TQSize( 660, 370 ) ); setBackground( m_originalBackground ); // Some misc initializations. @@ -77,10 +77,10 @@ KHangManView::KHangManView(KHangMan*parent, const char *name) m_accentedLetters = true; m_hintExists = true; // Assume hint exists - connect( m_letterInput, SIGNAL( returnPressed() ), - this, SLOT( slotTry() ) ); - connect( m_guessButton, SIGNAL( clicked() ), - this, SLOT( slotTry() )); + connect( m_letterInput, TQT_SIGNAL( returnPressed() ), + this, TQT_SLOT( slotTry() ) ); + connect( m_guessButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( slotTry() )); } @@ -92,7 +92,7 @@ KHangManView::~KHangManView() // Handle a guess of the letter in sChar. // -void KHangManView::replaceLetters(const QString& sChar) +void KHangManView::replaceLetters(const TQString& sChar) { int index = 0; bool b_end = false; @@ -131,17 +131,17 @@ void KHangManView::replaceLetters(const QString& sChar) } if (m_accentedLetters && !Prefs::accentedLetters()) { - if (sChar=="i") replaceLetters(QString::fromUtf8("í")); - if (sChar=="a") replaceLetters(QString::fromUtf8("à")); - if (sChar=="a") replaceLetters(QString::fromUtf8("á")); - if (sChar=="a") replaceLetters(QString::fromUtf8("ã")); - if (sChar=="u") replaceLetters(QString::fromUtf8("ü")); - if (sChar=="o") replaceLetters(QString::fromUtf8("ò")); - if (sChar=="o") replaceLetters(QString::fromUtf8("ó")); - if (sChar=="o") replaceLetters(QString::fromUtf8("õ")); - if (sChar=="e") replaceLetters(QString::fromUtf8("è")); - if (sChar=="e") replaceLetters(QString::fromUtf8("é")); - if (sChar=="u") replaceLetters(QString::fromUtf8("ù")); + if (sChar=="i") replaceLetters(TQString::fromUtf8("í")); + if (sChar=="a") replaceLetters(TQString::fromUtf8("à")); + if (sChar=="a") replaceLetters(TQString::fromUtf8("á")); + if (sChar=="a") replaceLetters(TQString::fromUtf8("ã")); + if (sChar=="u") replaceLetters(TQString::fromUtf8("ü")); + if (sChar=="o") replaceLetters(TQString::fromUtf8("ò")); + if (sChar=="o") replaceLetters(TQString::fromUtf8("ó")); + if (sChar=="o") replaceLetters(TQString::fromUtf8("õ")); + if (sChar=="e") replaceLetters(TQString::fromUtf8("è")); + if (sChar=="e") replaceLetters(TQString::fromUtf8("é")); + if (sChar=="u") replaceLetters(TQString::fromUtf8("ù")); } if (!Prefs::oneLetter()) m_guessedLetters << sChar; //appends the list only if not in One Letter only mode... @@ -154,30 +154,30 @@ void KHangManView::replaceLetters(const QString& sChar) } -bool KHangManView::containsChar(const QString &sChar) +bool KHangManView::containsChar(const TQString &sChar) { bool b = false; if (m_accentedLetters && !Prefs::accentedLetters()) { if (sChar=="i") - b = m_word.contains(QString::fromUtf8("í"), false); + b = m_word.contains(TQString::fromUtf8("í"), false); if (sChar=="a") - b = m_word.contains(QString::fromUtf8("à"), false) - || m_word.contains(QString::fromUtf8("á"), false) - || m_word.contains(QString::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.contains(QString::fromUtf8("ü"), false) - || m_word.contains(QString::fromUtf8("ù"), false); + b = m_word.contains(TQString::fromUtf8("ü"), false) + || m_word.contains(TQString::fromUtf8("ù"), false); if (sChar=="o") - b = m_word.contains(QString::fromUtf8("ò"), false) - || m_word.contains(QString::fromUtf8("ó"), false) - || m_word.contains(QString::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.contains(QString::fromUtf8("è"), false) - || m_word.contains(QString::fromUtf8("é"), false); + b = m_word.contains(TQString::fromUtf8("è"), false) + || m_word.contains(TQString::fromUtf8("é"), false); } return (b || m_word.contains(sChar, false)); @@ -188,21 +188,21 @@ bool KHangManView::containsChar(const QString &sChar) // Event handlers -void KHangManView::mousePressEvent(QMouseEvent *mouse) +void KHangManView::mousePressEvent(TQMouseEvent *mouse) { if (mouse->button() == RightButton && m_hintExists && Prefs::hint()) { KPassivePopup *myPopup = new KPassivePopup( m_letterInput); myPopup->setView(i18n("Hint"), m_hint ); - myPopup->setPalette(QToolTip::palette()); + myPopup->setPalette(TQToolTip::palette()); myPopup->setTimeout(Prefs::hintTimer()*1000); //show for 4 seconds as default int x=0, y=0; - QPoint abspos = mapToGlobal( QPoint( 0, 0 ) ); + TQPoint abspos = mapToGlobal( TQPoint( 0, 0 ) ); x = abspos.x() + width()*70/700; y = abspos.y() + height()*150/535; - QPoint point = QPoint(x, y); + TQPoint point = TQPoint(x, y); myPopup->show(mapToGlobal(point)); // Maybe it's better to popup where the mouse clicks, in that @@ -231,14 +231,14 @@ void KHangManView::setTheme() // Painting -void KHangManView::paintEvent( QPaintEvent * ) +void KHangManView::paintEvent( TQPaintEvent * ) { // This pixmap implements double buffering to remove all forms of // flicker in the repainting. - QPixmap buf(width(), height()); + TQPixmap buf(width(), height()); // Repaint the contents of the khangman view into the pixmap. - QPainter p(&buf); + TQPainter p(&buf); p.drawPixmap(0, 0, m_resizedBackground); paintHangman(p); paintWord(p); @@ -249,35 +249,35 @@ void KHangManView::paintEvent( QPaintEvent * ) } -void KHangManView::paintHangman(QPainter &p) +void KHangManView::paintHangman(TQPainter &p) { // Draw the animated hanged K if (Prefs::mode() == 0) // sea - p.drawPixmap(QRect(0, 0, + p.drawPixmap(TQRect(0, 0, width()*630/700, height()*285/535), m_animationPics[m_numMissedLetters]); else - p.drawPixmap(QRect(width()*68/700, height()*170/535, + p.drawPixmap(TQRect(width()*68/700, height()*170/535, width()*259/700, height()*228/535), m_animationPics[m_numMissedLetters]); } -void KHangManView::paintWord(QPainter &p) +void KHangManView::paintWord(TQPainter &p) { - QRect myRect; + TQRect myRect; if (Prefs::mode() == 0) //sea - myRect = QRect(0, height()-height()*126/535, + myRect = TQRect(0, height()-height()*126/535, width()*417/700, height()*126/535); else - myRect = QRect(0, height()-height()*126/535, + myRect = TQRect(0, height()-height()*126/535, width()*327/700, height()*126/535); - QFont tFont; + TQFont tFont; if (Prefs::mode() == 0) //sea - p.setPen( QColor(148, 156, 167)); + p.setPen( TQColor(148, 156, 167)); else - p.setPen( QColor(87, 0, 0)); + p.setPen( TQColor(87, 0, 0)); if (Prefs::selectedLanguage() =="tg") tFont.setFamily( "URW Bookman" ); @@ -292,17 +292,17 @@ void KHangManView::paintWord(QPainter &p) } -void KHangManView::paintMisses(QPainter &p) +void KHangManView::paintMisses(TQPainter &p) { // Get the color for the letters. - QColor letterColor; + TQColor letterColor; if (Prefs::mode() == 0) //sea - letterColor = QColor(148, 156, 167); + letterColor = TQColor(148, 156, 167); else - letterColor = QColor(87, 0, 0); + letterColor = TQColor(87, 0, 0); // Draw the missed letters - QFont tFont; + TQFont tFont; if (Prefs::selectedLanguage() =="tg") tFont.setFamily( "URW Bookman" ); else @@ -311,21 +311,21 @@ void KHangManView::paintMisses(QPainter &p) p.setPen( letterColor ); p.setFont(tFont); - QFontMetrics fm(tFont); - QRect fmRect(fm.boundingRect(m_missedLetters)); - QRect myRect = QRect(width() - fmRect.width(), 15, + TQFontMetrics fm(tFont); + TQRect fmRect(fm.boundingRect(m_missedLetters)); + TQRect myRect = TQRect(width() - fmRect.width(), 15, fmRect.width(), fm.height()); p.drawText(myRect, AlignLeft, m_missedLetters); // Draw the "Misses" word - QString misses = i18n("Misses"); - QFont mFont = QFont(Prefs::missesFontFamily()); + TQString misses = i18n("Misses"); + TQFont mFont = TQFont(Prefs::missesFontFamily()); mFont.setPointSize(30); p.setFont(mFont); - QFontMetrics fm2(mFont); - QRect fmRect2(fm2.boundingRect(misses)); - QRect myRect2(width()- fmRect.width() - fmRect2.width() - 15, + TQFontMetrics fm2(mFont); + TQRect fmRect2(fm2.boundingRect(misses)); + TQRect myRect2(width()- fmRect.width() - fmRect2.width() - 15, 15 - fm2.height() + fm.height(), fmRect2.width(), fm2.height()); p.setPen( letterColor ); @@ -333,21 +333,21 @@ void KHangManView::paintMisses(QPainter &p) } -void KHangManView::resizeEvent(QResizeEvent *) +void KHangManView::resizeEvent(TQResizeEvent *) { if(!m_originalBackground.isNull()) setBackground(m_originalBackground); - m_letterInput->setMinimumSize( QSize( height()/18, 0 ) ); + m_letterInput->setMinimumSize( TQSize( height()/18, 0 ) ); - QFont charWrite_font( m_letterInput->font() ); + TQFont charWrite_font( m_letterInput->font() ); charWrite_font.setPointSize( height()/18 ); charWrite_font.setFamily( "Sans Serif" ); m_letterInput->setFont( charWrite_font ); m_letterInput->setGeometry(width()-2*height()/12, height()-2*height()/16, height()/10, height()/10); - m_guessButton->setFont(QFont(Prefs::guessFontFamily(), height()/22)); + m_guessButton->setFont(TQFont(Prefs::guessFontFamily(), height()/22)); m_guessButton->setGeometry(width() - 2*height()/12 - m_guessButton->width()-5, height() - 2*height()/16, @@ -359,9 +359,9 @@ void KHangManView::resizeEvent(QResizeEvent *) // Slots -void KHangManView::setBackground(QPixmap& bgPix) +void KHangManView::setBackground(TQPixmap& bgPix) { - QImage img = bgPix.convertToImage(); + TQImage img = bgPix.convertToImage(); m_resizedBackground.resize(size()); m_resizedBackground.convertFromImage(img.smoothScale( width(), height())); } @@ -369,7 +369,7 @@ void KHangManView::setBackground(QPixmap& bgPix) void KHangManView::slotTry() { - QString guess = m_letterInput->text(); + TQString guess = m_letterInput->text(); kdDebug() << "guess as entered: " << guess << endl; // If the char is not a letter, empty the input and return. @@ -386,8 +386,8 @@ void KHangManView::slotTry() replaceLetters(guess); // This is needed because of the white spaces. - QString stripWord = m_goodWord; - QString sword = m_word; + TQString stripWord = m_goodWord; + TQString sword = m_word; if (dd > 0) { stripWord.replace(2*c, 1, ""); stripWord.replace(2*c-1, 1, ""); @@ -396,10 +396,10 @@ void KHangManView::slotTry() stripWord.replace(2*(dd-1)-1, 1, ""); } - QStringList rightChars = QStringList::split(" ", stripWord, true); - QString rightWord = rightChars.join(""); + TQStringList rightChars = TQStringList::split(" ", stripWord, true); + TQString rightWord = rightChars.join(""); update(); - sword.remove(QRegExp(" ")); + sword.remove(TQRegExp(" ")); // If the user made it... if (rightWord.stripWhiteSpace().lower() @@ -410,28 +410,28 @@ void KHangManView::slotTry() //TODO find a better way to finish // if (Prefs::sound()) { - QString soundFile = locate("data", "khangman/sounds/EW_Dialogue_Appear.ogg"); + TQString soundFile = locate("data", "khangman/sounds/EW_Dialogue_Appear.ogg"); if (soundFile != 0) KAudioPlayer::play(soundFile); } if (Prefs::wonDialog()) { // TODO: hide Hint KPassivePopup if any - QPoint point; + TQPoint point; KPassivePopup *popup = new KPassivePopup( this, "popup" ); popup->setAutoDelete( true ); popup->setTimeout( 4*1000 ); popup->setView(i18n("Congratulations,\nyou won!") ); int x =0, y = 0; - QPoint abspos = popup->pos(); + TQPoint abspos = popup->pos(); x = abspos.x() + width()*50/700; y = abspos.y() + height()*20/535; - point = QPoint(x, y); + point = TQPoint(x, y); popup->show(mapToGlobal(point)); - QTimer::singleShot( 4*1000, this, SLOT(slotNewGame()) ); + TQTimer::singleShot( 4*1000, this, TQT_SLOT(slotNewGame()) ); } - else if (KMessageBox::questionYesNo(this, i18n("Congratulations! You won! Do you want to play again?"),QString::null,i18n("Play Again"), i18n("Do Not Play")) == 3) + else if (KMessageBox::questionYesNo(this, i18n("Congratulations! You won! Do you want to play again?"),TQString::null,i18n("Play Again"), i18n("Do Not Play")) == 3) slotNewGame(); else kapp->quit(); @@ -451,33 +451,33 @@ void KHangManView::slotTry() if (m_numMissedLetters >= MAXWRONGGUESSES) { //TODO sequence to finish when hanged - QStringList charList=QStringList::split("", m_word); - QString theWord=charList.join(" "); + TQStringList charList=TQStringList::split("", m_word); + TQString theWord=charList.join(" "); m_goodWord = theWord; //usability: find another way to start a new game - QString newGameString = i18n("You lost. Do you want to play again?"); + TQString newGameString = i18n("You lost. Do you want to play again?"); if (Prefs::wonDialog()) { // TODO: hide Hint KPassivePopup if any - QPoint point; + TQPoint point; KPassivePopup *popup = new KPassivePopup(KPassivePopup::Boxed, this, "popup" ); popup->setAutoDelete( true ); popup->setTimeout( 4*1000 ); - QVBox *vb = new QVBox( popup ); + TQVBox *vb = new TQVBox( popup ); - QLabel *popLabel = new QLabel( vb); - popLabel->setFont(QFont("Sans Serif", 14, QFont::Normal)); + TQLabel *popLabel = new TQLabel( vb); + popLabel->setFont(TQFont("Sans Serif", 14, TQFont::Normal)); popLabel->setText(i18n("You lost!\nThe word was\n%1").arg(m_word)); popup->setView( vb ); - QPoint abspos = popup->pos(); + TQPoint abspos = popup->pos(); int x = abspos.x() + width() * 50 / 700; int y = abspos.y() + height() * 20 / 535; - popup->show(mapToGlobal(QPoint(x, y))); + popup->show(mapToGlobal(TQPoint(x, y))); - QTimer::singleShot( 4 * 1000, this, SLOT(slotNewGame()) ); + TQTimer::singleShot( 4 * 1000, this, TQT_SLOT(slotNewGame()) ); } - else if (KMessageBox::questionYesNo(this, newGameString, QString::null, i18n("Play Again"), i18n("Do Not Play")) == 3) + else if (KMessageBox::questionYesNo(this, newGameString, TQString::null, i18n("Play Again"), i18n("Do Not Play")) == 3) slotNewGame(); else kapp->quit(); @@ -488,7 +488,7 @@ void KHangManView::slotTry() // The letter is already guessed. // Show a popup that says as much. - QPoint point; + TQPoint point; KPassivePopup *popup = new KPassivePopup(KPassivePopup::Balloon, this, "popup" ); popup->setAutoDelete( true ); popup->setTimeout( 1000 ); @@ -499,22 +499,22 @@ void KHangManView::slotTry() if (m_missedLetters.contains(guess, false) > 0) { // FIXME: popup should be better placed. - QPoint abspos = popup->pos(); + TQPoint abspos = popup->pos(); x = abspos.x() + width()*400/700; y = abspos.y() + height()*50/535; - point = QPoint(x, y); + point = TQPoint(x, y); // Create a 1 second single-shot timer, and reenable user // input after this time. - QTimer::singleShot( Prefs::missedTimer() * 1000, - this, SLOT(enableUserInput()) ); + TQTimer::singleShot( Prefs::missedTimer() * 1000, + this, TQT_SLOT(enableUserInput()) ); // Disable any possible entry m_letterInput->setEnabled(false); } if (m_goodWord.contains(guess, false) > 0) { - QPoint abspos = popup->pos(); + TQPoint abspos = popup->pos(); if (Prefs::mode() == 0) { // sea @@ -525,10 +525,10 @@ void KHangManView::slotTry() x = abspos.x() + width()*200/700; y = abspos.y() + height()*485/535; } - point = QPoint(x, y); + point = TQPoint(x, y); - QTimer::singleShot( Prefs::missedTimer() * 1000, - this, SLOT(enableUserInput()) ); + TQTimer::singleShot( Prefs::missedTimer() * 1000, + this, TQT_SLOT(enableUserInput()) ); // Disable any possible entry m_letterInput->setEnabled(false); @@ -552,7 +552,7 @@ void KHangManView::enableUserInput() void KHangManView::slotNewGame() { if (Prefs::sound()) { - QString soundFile = locate("data", "khangman/sounds/new_game.ogg"); + TQString soundFile = locate("data", "khangman/sounds/new_game.ogg"); if (soundFile != 0) KAudioPlayer::play(soundFile); } @@ -585,13 +585,13 @@ void KHangManView::game() kdDebug() << "level " << Prefs::levelFile() << endl; // Check if the data files are installed in the correct dir. - QString myString = QString("khangman/data/%1/%2") + TQString myString = TQString("khangman/data/%1/%2") .arg(Prefs::selectedLanguage()) .arg(Prefs::levelFile()); - QFile myFile; + TQFile myFile; myFile.setName(locate("data", myString)); if (!myFile.exists()) { - QString mString = i18n("File $KDEDIR/share/apps/khangman/data/%1/%2 not found!\n" + TQString mString = i18n("File $KDEDIR/share/apps/khangman/data/%1/%2 not found!\n" "Check your installation, please!") .arg(Prefs::selectedLanguage()) .arg(Prefs::levelFile()); @@ -600,13 +600,13 @@ void KHangManView::game() } // We open the file and store info into the stream... - QFile openFileStream(myFile.name()); + TQFile openFileStream(myFile.name()); openFileStream.open(IO_ReadOnly); - QTextStream readFileStr(&openFileStream); - readFileStr.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream readFileStr(&openFileStream); + readFileStr.setEncoding(TQTextStream::UnicodeUTF8); // Alldata contains all the words from the file - QStringList allData = QStringList::split("\n", readFileStr.read(), true); + TQStringList allData = TQStringList::split("\n", readFileStr.read(), true); openFileStream.close(); // Detects if file is a kvtml file so that it's a hint enable file @@ -652,9 +652,9 @@ void KHangManView::game() } // 3. Find · - int e = m_word.find( QString::fromUtf8("·") ); + int e = m_word.find( TQString::fromUtf8("·") ); if (e>0) - m_goodWord.replace(2*e, 1, QString::fromUtf8("·") ); + m_goodWord.replace(2*e, 1, TQString::fromUtf8("·") ); // 4. Find ' int h = m_word.find( "'" ); @@ -666,7 +666,7 @@ void KHangManView::game() void KHangManView::readFile() { kdDebug() << "in read kvtml file " << endl; - QString myString=QString("khangman/data/%1/%2").arg(Prefs::selectedLanguage()).arg(Prefs::levelFile()); + TQString myString=TQString("khangman/data/%1/%2").arg(Prefs::selectedLanguage()).arg(Prefs::levelFile()); myString= locate("data", myString); KEduVocDataItemList verbs = KEduVocData::parse(myString); @@ -706,20 +706,20 @@ void KHangManView::loadAnimation() { switch (Prefs::mode()) { case Prefs::EnumMode::sea: - m_originalBackground = QPixmap(locate("data", "khangman/pics/sea/sea_theme.png") ); + m_originalBackground = TQPixmap(locate("data", "khangman/pics/sea/sea_theme.png") ); m_themeName = "sea"; - m_letterInput->setPaletteForegroundColor( QColor( 83, 40, 14) ); - m_guessButton->setPaletteBackgroundColor( QColor( 115, 64, 49) ); - m_guessButton->setPaletteForegroundColor( QColor( 148, 156, 167) ); + m_letterInput->setPaletteForegroundColor( TQColor( 83, 40, 14) ); + m_guessButton->setPaletteBackgroundColor( TQColor( 115, 64, 49) ); + m_guessButton->setPaletteForegroundColor( TQColor( 148, 156, 167) ); m_guessButton->setBackgroundOrigin( KPushButton::ParentOrigin ); break; case Prefs::EnumMode::desert: - m_originalBackground = QPixmap(locate("data","khangman/pics/desert/desert_theme.png") ); + m_originalBackground = TQPixmap(locate("data","khangman/pics/desert/desert_theme.png") ); m_themeName = "desert"; - m_letterInput->setPaletteForegroundColor( QColor( 87, 0, 0) ); - m_guessButton->setPaletteBackgroundColor( QColor( 205, 214, 90) ); - m_guessButton->setPaletteForegroundColor( QColor( 87, 0, 0) ); + m_letterInput->setPaletteForegroundColor( TQColor( 87, 0, 0) ); + m_guessButton->setPaletteBackgroundColor( TQColor( 205, 214, 90) ); + m_guessButton->setPaletteForegroundColor( TQColor( 87, 0, 0) ); m_guessButton->setBackgroundOrigin( KPushButton::ParentOrigin ); break; } @@ -727,7 +727,7 @@ void KHangManView::loadAnimation() // Now we load the pixmaps... for (uint i = 0; i < 11; i++) { m_animationPics[i].load(locate( "data", - QString("khangman/pics/%1/animation%2.png") + TQString("khangman/pics/%1/animation%2.png") .arg(m_themeName).arg(i) )); } } diff --git a/khangman/khangman/khangmanview.h b/khangman/khangman/khangmanview.h index 593c94a0..7ffffcf2 100644 --- a/khangman/khangman/khangmanview.h +++ b/khangman/khangman/khangmanview.h @@ -59,7 +59,7 @@ public: { m_accentedLetters = _accentedLetters; } /// Enter a letter into the input widget. - void enterLetter(QString letter) { m_letterInput->setText(letter); } + void enterLetter(TQString letter) { m_letterInput->setText(letter); } signals: @@ -86,11 +86,11 @@ private: protected: // Events - void paintEvent( QPaintEvent * ); - void resizeEvent( QResizeEvent * ); + void paintEvent( TQPaintEvent * ); + void resizeEvent( TQResizeEvent * ); /// Enable hints on mouse right click if Hints exist. - virtual void mousePressEvent( QMouseEvent *mouse ); + virtual void mousePressEvent( TQMouseEvent *mouse ); private: @@ -98,9 +98,9 @@ private: // Painting /// Paint the animated hanged K sequence. - void paintHangman(QPainter &p); - void paintWord(QPainter &p); - void paintMisses(QPainter &p); + void paintHangman(TQPainter &p); + void paintWord(TQPainter &p); + void paintMisses(TQPainter &p); /// Reset everything to start a new game, missed letters is empty. void reset(); @@ -112,13 +112,13 @@ private: /// Load the K animated sequence depending of the theme. void loadAnimation(); - /// Set the background pixmap to the QPixmap argument. - void setBackground(QPixmap& ); + /// Set the background pixmap to the TQPixmap argument. + void setBackground(TQPixmap& ); - /// Return true if the word contains the char in the QString. - bool containsChar(const QString &); + /// Return true if the word contains the char in the TQString. + bool containsChar(const TQString &); - void replaceLetters(const QString &); + void replaceLetters(const TQString &); public slots: /// If you want to play with a new word @@ -144,17 +144,17 @@ private: // These spaces will then be added at draw time. /// The word to be guessed. - QString m_word; + TQString m_word; /// goodWord is the hidden word that is filled in during the game. /// Initialized to "_ " * (number of letters in the word). - QString m_goodWord; + TQString m_goodWord; /// Contains all letters already guessed. - QStringList m_guessedLetters; + TQStringList m_guessedLetters; // Stores the missed letters that are shown on the screen. // Initialiazed to "_ " * MAXWRONGGUESSES. - QString m_missedLetters; + TQString m_missedLetters; /// How many times you missed. /// When this reaches MAXWRONGGUESSES, you are hanged. int m_numMissedLetters; @@ -166,12 +166,12 @@ private: // the same word is not given twice in a row. int m_lastWordNumber; - QString m_themeName; + TQString m_themeName; KRandomSequence m_random; /// true if a hint exists bool m_hintExists; - QString m_hint; + TQString m_hint; /// true if the language contains accented letters. /// This is true for, among others, es, ca, pt or pt_BR @@ -181,11 +181,11 @@ private: // Graphics ---------------- // Background picture (sea or desert) - QPixmap m_originalBackground; // Original image - QPixmap m_resizedBackground; // Resized to fit the window. + TQPixmap m_originalBackground; // Original image + TQPixmap m_resizedBackground; // Resized to fit the window. /// The hanged K animation sequence. - QPixmap m_animationPics[MAXWRONGGUESSES + 1]; + TQPixmap m_animationPics[MAXWRONGGUESSES + 1]; // Widgets ---------------- diff --git a/khangman/khangman/khnewstuff.cpp b/khangman/khangman/khnewstuff.cpp index 829a5f24..f15fca87 100644 --- a/khangman/khangman/khnewstuff.cpp +++ b/khangman/khangman/khnewstuff.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include "prefs.h" @@ -38,7 +38,7 @@ KHNewStuff::KHNewStuff( KHangManView *view ) : { } -bool KHNewStuff::install( const QString &fileName ) +bool KHNewStuff::install( const TQString &fileName ) { kdDebug(5850) << "KHNewStuff::install(): " << fileName << endl; @@ -47,7 +47,7 @@ bool KHNewStuff::install( const QString &fileName ) return false; const KArchiveDirectory *archiveDir = archive.directory(); KStandardDirs myStdDir; - const QString destDir =myStdDir.saveLocation("data", kapp->instanceName() + "/data/", true); + const TQString destDir =myStdDir.saveLocation("data", kapp->instanceName() + "/data/", true); KStandardDirs::makeDir( destDir ); archiveDir->copyTo(destDir); archive.close(); @@ -60,7 +60,7 @@ bool KHNewStuff::install( const QString &fileName ) return true; } -bool KHNewStuff::createUploadFile( const QString &/*fileName*/ ) +bool KHNewStuff::createUploadFile( const TQString &/*fileName*/ ) { //return mView->saveCalendar( fileName ); return true; diff --git a/khangman/khangman/khnewstuff.h b/khangman/khangman/khnewstuff.h index 75fa7c12..826300f2 100644 --- a/khangman/khangman/khnewstuff.h +++ b/khangman/khangman/khnewstuff.h @@ -34,8 +34,8 @@ class KHNewStuff : public KNewStuff public: KHNewStuff( KHangManView * ); - bool install( const QString &fileName ); - bool createUploadFile( const QString &fileName ); + bool install( const TQString &fileName ); + bool createUploadFile( const TQString &fileName ); private: KHangManView *m_view; diff --git a/khangman/khangman/main.cpp b/khangman/khangman/main.cpp index 9cbf84e7..303d15c4 100644 --- a/khangman/khangman/main.cpp +++ b/khangman/khangman/main.cpp @@ -115,8 +115,8 @@ int main(int argc, char **argv) KApplication app; KHangMan *mainWin = 0; - QFont f("Domestic Manners", 12, QFont::Normal, true); - QFont fd("Dustismo Roman", 12, QFont::Normal, true); + TQFont f("Domestic Manners", 12, TQFont::Normal, true); + TQFont fd("Dustismo Roman", 12, TQFont::Normal, true); if (!fontChecker::checkInstalled(f, locate("appdata", "fonts/Domestic_Manners.ttf"))) { KProcess *proc = new KProcess; diff --git a/khangman/khangman/timer.cpp b/khangman/khangman/timer.cpp index 7d1f7304..69bcf6f7 100644 --- a/khangman/khangman/timer.cpp +++ b/khangman/khangman/timer.cpp @@ -20,8 +20,8 @@ #include -#include -#include +#include +#include #include "timer.h" #include "prefs.h" @@ -30,17 +30,17 @@ Timer::Timer() :timerdlg() { - timeHintLabel->setText(QString::number(Prefs::hintTimer()) + " " + i18n("seconds")); - timeMissedLabel->setText(QString::number(Prefs::missedTimer()) + " " + i18n("seconds")); - connect(kcfg_HintTimer, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged())); - connect(kcfg_MissedTimer, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged())); + timeHintLabel->setText(TQString::number(Prefs::hintTimer()) + " " + i18n("seconds")); + timeMissedLabel->setText(TQString::number(Prefs::missedTimer()) + " " + i18n("seconds")); + connect(kcfg_HintTimer, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(sliderValueChanged())); + connect(kcfg_MissedTimer, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(sliderValueChanged())); } void Timer::sliderValueChanged() { - timeMissedLabel->setText(QString::number(kcfg_MissedTimer->value()) + " " + i18n("seconds")); - timeHintLabel->setText(QString::number(kcfg_HintTimer->value()) + " " + i18n("seconds")); + timeMissedLabel->setText(TQString::number(kcfg_MissedTimer->value()) + " " + i18n("seconds")); + timeHintLabel->setText(TQString::number(kcfg_HintTimer->value()) + " " + i18n("seconds")); } diff --git a/khangman/khangman/timer.h b/khangman/khangman/timer.h index cb3373c1..ad6b50bb 100644 --- a/khangman/khangman/timer.h +++ b/khangman/khangman/timer.h @@ -39,7 +39,7 @@ public: Timer(); protected slots: - ///When the QSlider value changes + ///When the TQSlider value changes void sliderValueChanged(); }; -- cgit v1.2.1