diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:39:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:39:55 +0000 |
commit | 0a6e0958c03e41c87b15557b6f407874f20c2f8d (patch) | |
tree | 2cdd58c4013b1be09cfcbb4ddae2b05712b9aeee /ktouch | |
parent | 83f9dfafc157ff7823804b3ff457b43d021a5b4b (diff) | |
download | tdeedu-0a6e0958c03e41c87b15557b6f407874f20c2f8d.tar.gz tdeedu-0a6e0958c03e41c87b15557b6f407874f20c2f8d.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1157642 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ktouch')
41 files changed, 866 insertions, 866 deletions
diff --git a/ktouch/src/ktouch.cpp b/ktouch/src/ktouch.cpp index 231bc402..632aabe1 100644 --- a/ktouch/src/ktouch.cpp +++ b/ktouch/src/ktouch.cpp @@ -17,11 +17,11 @@ #include <algorithm> // QT Header -#include <qvbox.h> -#include <qsignalmapper.h> -#include <qcheckbox.h> -#include <qlabel.h> -#include <qgroupbox.h> +#include <tqvbox.h> +#include <tqsignalmapper.h> +#include <tqcheckbox.h> +#include <tqlabel.h> +#include <tqgroupbox.h> //#include <qimevent.h> // KDE Header @@ -75,7 +75,7 @@ KTouch::KTouch() setupActions(); // create the GUI reading the ui.rc file if (!initialGeometrySet()) - resize( QSize(700, 510).expandedTo(minimumSizeHint())); + resize( TQSize(700, 510).expandedTo(minimumSizeHint())); setupGUI(ToolBar | Keys | StatusBar | Create); setAutoSaveSettings(); // Read user statistics @@ -107,7 +107,7 @@ KTouch::KTouch() if (Prefs::currentLectureFile().isNull() || !m_lecture.loadXML(this, Prefs::currentLectureFile() )) { - Prefs::setCurrentLectureFile(QString::null); + Prefs::setCurrentLectureFile(TQString::null); m_defaultLectureAction->setCurrentItem(-1); } else { @@ -168,7 +168,7 @@ void KTouch::applyPreferences() { } // ---------------------------------------------------------------------------- -void KTouch::keyPressEvent(QKeyEvent *keyEvent) { +void KTouch::keyPressEvent(TQKeyEvent *keyEvent) { if (keyEvent->text().isEmpty()) return; // if we the training session is paused, continue training now @@ -179,18 +179,18 @@ void KTouch::keyPressEvent(QKeyEvent *keyEvent) { if (keyEvent->text().length() > 1) { kdDebug() << "[KTouch::keyPressEvent] text = '" << keyEvent->text() << "'" << endl; } - QChar key = keyEvent->text().at(0); // get first unicode character + TQChar key = keyEvent->text().at(0); // get first unicode character // HACK : manually filter out known dead keys // bool has_dead_key = true; switch (key.unicode()) { - case 94 : m_lastDeadKey = QChar(uint(94)); break; - case 176 : m_lastDeadKey = QChar(uint(176)); break; - case 180 : m_lastDeadKey = QChar(uint(180)); break; - case 96 : m_lastDeadKey = QChar(uint(96)); break; - case 126 : m_lastDeadKey = QChar(uint(126)); break; - default : m_lastDeadKey = QChar(uint(0)); + case 94 : m_lastDeadKey = TQChar(uint(94)); break; + case 176 : m_lastDeadKey = TQChar(uint(176)); break; + case 180 : m_lastDeadKey = TQChar(uint(180)); break; + case 96 : m_lastDeadKey = TQChar(uint(96)); break; + case 126 : m_lastDeadKey = TQChar(uint(126)); break; + default : m_lastDeadKey = TQChar(uint(0)); } - if (m_lastDeadKey != QChar(uint(0)) && key == m_lastDeadKey) { + if (m_lastDeadKey != TQChar(uint(0)) && key == m_lastDeadKey) { // kdDebug() << "Got dead key = " << m_lastDeadKey << endl; //keyEvent->accept(); // return; @@ -198,9 +198,9 @@ void KTouch::keyPressEvent(QKeyEvent *keyEvent) { if (key.isPrint()) m_trainer->keyPressed(key); - else if (key==QChar(8)) + else if (key==TQChar(8)) m_trainer->backspacePressed(); - else if (key==QChar(13)) + else if (key==TQChar(13)) m_trainer->enterPressed(); else return; // unrecognised char -> don't accept it! Maybe the key is for somebody else? @@ -209,7 +209,7 @@ void KTouch::keyPressEvent(QKeyEvent *keyEvent) { // ---------------------------------------------------------------------------- -void KTouch::imEndEvent ( QIMEvent * e ){ +void KTouch::imEndEvent ( TQIMEvent * e ){ m_trainer->keyPressed(e->text().at(0)); e->accept(); } @@ -285,7 +285,7 @@ void KTouch::configCommonColorsToggled(bool on) { // The action File->Open lecture... void KTouch::fileOpenLecture() { trainingPause(); - KURL tmp = KFileDialog::getOpenURL(QString::null, QString::null, this, i18n("Select Training Lecture File") ); + KURL tmp = KFileDialog::getOpenURL(TQString::null, TQString::null, this, i18n("Select Training Lecture File") ); if (!tmp.isEmpty()) { // first store training statistics m_trainer->storeTrainingStatistics(); @@ -323,9 +323,9 @@ void KTouch::fileEditLecture() { void KTouch::fileEditColors() { trainingPause(); // Create a copy of the currently editable color schemes. - QValueList<KTouchColorScheme> tmp_list; + TQValueList<KTouchColorScheme> tmp_list; int default_schemes = 0; - for (QValueVector<KTouchColorScheme>::const_iterator it = KTouchColorScheme::m_colorSchemes.constBegin(); + for (TQValueVector<KTouchColorScheme>::const_iterator it = KTouchColorScheme::m_colorSchemes.constBegin(); it != KTouchColorScheme::m_colorSchemes.constEnd(); ++it) { if (!it->m_default) tmp_list.append(*it); @@ -337,13 +337,13 @@ void KTouch::fileEditColors() { int selected; dlg.startEditor( tmp_list, Prefs::currentColorScheme() - default_schemes, selected); KTouchColorScheme::createDefaults(); - for (QValueList<KTouchColorScheme>::const_iterator it = tmp_list.constBegin(); + for (TQValueList<KTouchColorScheme>::const_iterator it = tmp_list.constBegin(); it != tmp_list.constEnd(); ++it) { KTouchColorScheme::m_colorSchemes.append(*it); } // update the quick select menu - QStringList schemes_list; + TQStringList schemes_list; for (unsigned int i=0; i<KTouchColorScheme::m_colorSchemes.count(); ++i) schemes_list.append(KTouchColorScheme::m_colorSchemes[i].m_name); m_keyboardColorAction->setItems(schemes_list); @@ -431,16 +431,16 @@ void KTouch::optionsPreferences() { dialog->addPage(m_pageKeyboard, i18n("Keyboard Settings"), "keyboard_layout"); m_pageColors = new KTouchPrefColorsLayout(0, "Colors"); dialog->addPage(m_pageColors, i18n("Color Settings"), "package_graphics"); - connect(dialog, SIGNAL(settingsChanged()), this, SLOT(applyPreferences())); + connect(dialog, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(applyPreferences())); // TODO : Connect some other buttons/check boxes of the dialog - connect(m_pageGeneral->kcfg_OverrideLectureFont, SIGNAL(toggled(bool)), - this, SLOT(configOverrideLectureFontToggled(bool))); - connect(m_pageKeyboard->kcfg_OverrideKeyboardFont, SIGNAL(toggled(bool)), - this, SLOT(configOverrideKeyboardFontToggled(bool))); - connect(m_pageTraining->kcfg_AutoLevelChange, SIGNAL(toggled(bool)), - this, SLOT(configAutoLevelChangeToggled(bool))); - connect(m_pageColors->kcfg_CommonTypingLineColors, SIGNAL(toggled(bool)), - this, SLOT(configCommonColorsToggled(bool))); + connect(m_pageGeneral->kcfg_OverrideLectureFont, TQT_SIGNAL(toggled(bool)), + this, TQT_SLOT(configOverrideLectureFontToggled(bool))); + connect(m_pageKeyboard->kcfg_OverrideKeyboardFont, TQT_SIGNAL(toggled(bool)), + this, TQT_SLOT(configOverrideKeyboardFontToggled(bool))); + connect(m_pageTraining->kcfg_AutoLevelChange, TQT_SIGNAL(toggled(bool)), + this, TQT_SLOT(configAutoLevelChangeToggled(bool))); + connect(m_pageColors->kcfg_CommonTypingLineColors, TQT_SIGNAL(toggled(bool)), + this, TQT_SLOT(configCommonColorsToggled(bool))); // call the functions to enable/disable controls depending on settings configOverrideLectureFontToggled(Prefs::overrideLectureFont()); configOverrideKeyboardFontToggled(Prefs::overrideKeyboardFont()); @@ -450,7 +450,7 @@ void KTouch::optionsPreferences() { } // ---------------------------------------------------------------------------- -void KTouch::changeStatusbarMessage(const QString& text) { +void KTouch::changeStatusbarMessage(const TQString& text) { statusBar()->message(text); } // ---------------------------------------------------------------------------- @@ -487,7 +487,7 @@ void KTouch::changeLecture(int num) { if (static_cast<unsigned int>(num)>=m_lectureFiles.count()) return; trainingPause(); KTouchLecture l; - QString fileName = m_lectureFiles[num]; + TQString fileName = m_lectureFiles[num]; if (!l.loadXML(this, KURL::fromPathOrURL(fileName))) { KMessageBox::sorry(0, i18n("Could not find/open the lecture file '%1'.").arg(fileName) ); m_defaultLectureAction->setCurrentItem(-1); @@ -527,7 +527,7 @@ bool KTouch::queryExit() { } // ---------------------------------------------------------------------------- -void KTouch::resizeEvent(QResizeEvent * event) { +void KTouch::resizeEvent(TQResizeEvent * event) { changeStatusbarStats(m_trainer->m_levelStats.m_correctChars, m_trainer->m_levelStats.m_totalChars, m_trainer->m_levelStats.m_words, m_trainer->m_sessionStats.m_correctChars, m_trainer->m_sessionStats.m_totalChars, m_trainer->m_sessionStats.m_words); KMainWindow::resizeEvent(event); @@ -550,7 +550,7 @@ void KTouch::readProperties(KConfig *config) { /* // The application is about to be restored due to session management. // Let's read all the stuff that was set when the application was terminated (during KDE logout). - QString session = config->readEntry("Session"); + TQString session = config->readEntry("Session"); if (!session.isEmpty()) m_trainer->m_session = KTouchTrainingSession(session); m_trainer->m_level = config->readNumEntry("Level", 0); @@ -612,9 +612,9 @@ void KTouch::init() { //kdDebug() << "[KTouch::init] " << m_examinationFiles.count() << " examination files available" << endl; if (Prefs::currentLectureFile() == "default") { - Prefs::setCurrentLectureFile(QString::null); + Prefs::setCurrentLectureFile(TQString::null); // /// \todo look up a lecture in the language of the KDE locale -/* QString default_lecture = "default"; +/* TQString default_lecture = "default"; if (m_lectureFiles.count() > 0) default_lecture = m_lectureFiles[0]; Prefs::setCurrentLectureFile( default_lecture ); */ @@ -623,12 +623,12 @@ void KTouch::init() { // if keyboard layout (loaded by Prefs is not available (e.g. the // layout file has been deleted) switch to default keyboard if (m_keyboardFiles.contains(Prefs::currentKeyboardFile() )==0) { - QString default_keyboard; + TQString default_keyboard; // determine locale - QString lang = KGlobal::locale()->language(); - QString fname = lang + ".keyboard"; + TQString lang = KGlobal::locale()->language(); + TQString fname = lang + ".keyboard"; // try to find keyboard with current locale - QStringList::const_iterator it = m_keyboardFiles.constBegin(); + TQStringList::const_iterator it = m_keyboardFiles.constBegin(); while (it != m_keyboardFiles.constEnd() && (*it).find(fname) == -1) ++it; if (it == m_keyboardFiles.constEnd()) { fname = lang.left(2) + ".keyboard"; @@ -657,13 +657,13 @@ void KTouch::initTrainingSession() { //kdDebug() << "[KTouch::initTrainingSession] setting up layouts and widgets for new training session..." << endl; // Build the training area. The status widget has a fixed vertical size, the slide line and the // keyboard grow according to their vertical stretch factors (see last argument in the constructors - // of QSizePolicy) - QVBox * mainLayout = new QVBox( this ); + // of TQSizePolicy) + TQVBox * mainLayout = new TQVBox( this ); m_statusWidget = new KTouchStatus( mainLayout ); m_slideLineWidget = new KTouchSlideLine( mainLayout ); - m_slideLineWidget->setSizePolicy( QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding, 0, 1) ); + m_slideLineWidget->setSizePolicy( TQSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Expanding, 0, 1) ); m_keyboardWidget = new KTouchKeyboardWidget( mainLayout ); - m_keyboardWidget->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding, 0, 3) ); + m_keyboardWidget->setSizePolicy(TQSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Expanding, 0, 3) ); setCentralWidget(mainLayout); // apply the settings to the widgets m_slideLineWidget->applyPreferences(); @@ -684,41 +684,41 @@ void KTouch::initTrainingSession() { void KTouch::setupActions() { // *** File menu *** new KAction(i18n("&Open lecture..."), "open_lecture", 0, - this, SLOT(fileOpenLecture()), actionCollection(), "file_openlecture"); + this, TQT_SLOT(fileOpenLecture()), actionCollection(), "file_openlecture"); new KAction(i18n("&Edit lecture..."), "edit_lecture", 0, - this, SLOT(fileEditLecture()), actionCollection(), "file_editlecture"); + this, TQT_SLOT(fileEditLecture()), actionCollection(), "file_editlecture"); new KAction(i18n("&Edit color scheme..."), "edit_colors", 0, - this, SLOT(fileEditColors()), actionCollection(), "file_editcolors"); + this, TQT_SLOT(fileEditColors()), actionCollection(), "file_editcolors"); // new KAction(i18n("&Edit Keyboard..."), "edit_keyboard", 0, -// this, SLOT(fileEditKeyboard()), actionCollection(), "file_editkeyboard"); - KStdAction::quit(this, SLOT(fileQuit()), actionCollection()); +// this, TQT_SLOT(fileEditKeyboard()), actionCollection(), "file_editkeyboard"); + KStdAction::quit(this, TQT_SLOT(fileQuit()), actionCollection()); // *** Training menu *** new KAction(i18n("&Start New Session"), "launch", 0, - this, SLOT(trainingNewSession()), actionCollection(), "training_newsession"); + this, TQT_SLOT(trainingNewSession()), actionCollection(), "training_newsession"); m_trainingPause = new KAction(i18n("&Pause Session"), "player_pause", 0, - this, SLOT(trainingPause()), actionCollection(), "training_pause"); + this, TQT_SLOT(trainingPause()), actionCollection(), "training_pause"); new KAction(i18n("&Lecture Statistics"), "kalarm", 0, - this, SLOT(trainingStatistics()), actionCollection(), "training_stats"); + this, TQT_SLOT(trainingStatistics()), actionCollection(), "training_stats"); // Setup menu entries for the training lectures m_defaultLectureAction = new KSelectAction(i18n("Default &Lectures"), 0, this, 0, actionCollection(), "default_lectures"); m_defaultLectureAction->setMenuAccelsEnabled(false); m_defaultLectureAction->setItems(m_lectureTitles); m_defaultLectureAction->setCurrentItem(0); - connect (m_defaultLectureAction, SIGNAL(activated(int)), this, SLOT(changeLecture(int))); + connect (m_defaultLectureAction, TQT_SIGNAL(activated(int)), this, TQT_SLOT(changeLecture(int))); // *** Settings menu *** - KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); + KStdAction::preferences(this, TQT_SLOT(optionsPreferences()), actionCollection()); // Setup menu entries for keyboard layouts m_keyboardLayoutAction= new KSelectAction(i18n("&Keyboard Layouts"), 0, this, 0, actionCollection(), "keyboard_layouts"); m_keyboardLayoutAction->setMenuAccelsEnabled(false); m_keyboardLayoutAction->setItems(m_keyboardTitles); - connect (m_keyboardLayoutAction, SIGNAL(activated(int)), this, SLOT(changeKeyboard(int))); + connect (m_keyboardLayoutAction, TQT_SIGNAL(activated(int)), this, TQT_SLOT(changeKeyboard(int))); // Setup menu entries for colour schemes m_keyboardColorAction = new KSelectAction(i18n("&Color Schemes"), 0, this, 0, actionCollection(), "keyboard_schemes"); - QStringList schemes_list; + TQStringList schemes_list; for (unsigned int i=0; i<KTouchColorScheme::m_colorSchemes.count(); ++i) schemes_list.append(KTouchColorScheme::m_colorSchemes[i].m_name); m_keyboardColorAction->setMenuAccelsEnabled(false); @@ -726,7 +726,7 @@ void KTouch::setupActions() { if (static_cast<unsigned int>(Prefs::currentColorScheme()) >= schemes_list.count()) Prefs::setCurrentColorScheme(1); m_keyboardColorAction->setCurrentItem(Prefs::currentColorScheme()); - connect (m_keyboardColorAction, SIGNAL(activated(int)), this, SLOT(changeColor(int))); + connect (m_keyboardColorAction, TQT_SIGNAL(activated(int)), this, TQT_SLOT(changeColor(int))); } // ---------------------------------------------------------------------------- @@ -735,7 +735,7 @@ void KTouch::setupActions() { void KTouch::updateFontFromLecture() { // if the lecture requires a font, try this if (!m_lecture.m_fontSuggestions.isEmpty()) { - QFont f; + TQFont f; // TODO : if multiple font suggestions are given, try one after another until a // suggested font is found if (f.fromString(m_lecture.m_fontSuggestions)) m_slideLineWidget->setFont(f); @@ -755,24 +755,24 @@ void KTouch::updateFileLists() { // remove the number layout, since this is the necessary default layout and will be // added anyway - QStringList::iterator it = m_keyboardFiles.find("number.keyboard"); + TQStringList::iterator it = m_keyboardFiles.find("number.keyboard"); if (it!=m_keyboardFiles.end()) m_keyboardFiles.remove(it); m_keyboardTitles.clear(); - for (QStringList::const_iterator cit = m_keyboardFiles.constBegin(); + for (TQStringList::const_iterator cit = m_keyboardFiles.constBegin(); cit != m_keyboardFiles.constEnd(); ++cit) { // extract titles from keyboard files and store them in the // m_keyboardTitles string list // get the filename alone - QString fname = KURL(*cit).fileName(); + TQString fname = KURL(*cit).fileName(); // get the filename without the .keyboard fname.truncate(fname.length() - 9); // get everything in front of the first . - QString lang_iso = fname.section('.',0,0); + TQString lang_iso = fname.section('.',0,0); // get language description of file names - QString lang_name = KGlobal::locale()->twoAlphaToLanguageName(lang_iso); + TQString lang_name = KGlobal::locale()->twoAlphaToLanguageName(lang_iso); // kdDebug() << fname << " | " << lang_iso << " | " << lang_name << endl; if (lang_name.isEmpty()) lang_name = KGlobal::locale()->twoAlphaToCountryName(lang_iso); @@ -792,13 +792,13 @@ void KTouch::updateFileLists() { // Now lets find the lecture files. // TODO : search in i18n() directories - QStringList lectureFiles = dirs->findAllResources("data","ktouch/*.ktouch.xml"); + TQStringList lectureFiles = dirs->findAllResources("data","ktouch/*.ktouch.xml"); // Now extract the titles of the lecture files and populate the string lists used in the program m_lectureFiles.clear(); m_lectureTitles.clear(); if (!lectureFiles.isEmpty()) { // extract the prefixes - for (QStringList::iterator it=lectureFiles.begin(); it!=lectureFiles.end(); ++it) { + for (TQStringList::iterator it=lectureFiles.begin(); it!=lectureFiles.end(); ++it) { KURL url(*it); KTouchLecture l; // only add lecture if we can actually load it @@ -816,16 +816,16 @@ void KTouch::updateFileLists() { } // Now find predefined files with colour schemes - QStringList colour_schemes = dirs->findAllResources("data","ktouch/*.colour_scheme"); - // TODO : read in colour schemes and populate QValueList<KTouchColorScheme> + TQStringList colour_schemes = dirs->findAllResources("data","ktouch/*.colour_scheme"); + // TODO : read in colour schemes and populate TQValueList<KTouchColorScheme> } // ---------------------------------------------------------------------------- void KTouch::updateLectureActionCheck() { int num = 0; - QStringList::iterator it = m_lectureFiles.begin(); - QString fname = Prefs::currentLectureFile(); + TQStringList::iterator it = m_lectureFiles.begin(); + TQString fname = Prefs::currentLectureFile(); while (it != m_lectureFiles.end() && (*it).find(fname) == -1) { ++it; ++num; @@ -837,8 +837,8 @@ void KTouch::updateLectureActionCheck() { void KTouch::updateKeyboardActionCheck() { int num = 0; - QStringList::iterator it = m_keyboardFiles.begin(); - QString fname = Prefs::currentKeyboardFile(); + TQStringList::iterator it = m_keyboardFiles.begin(); + TQString fname = Prefs::currentKeyboardFile(); while (it != m_keyboardFiles.end() && (*it).find(fname) == -1) { ++it; ++num; @@ -849,25 +849,25 @@ void KTouch::updateKeyboardActionCheck() { // ---------------------------------------------------------------------------- /* -void KTouch::imStartEvent(QIMEvent *e) { +void KTouch::imStartEvent(TQIMEvent *e) { kdDebug() << "[KTouch::imStartEvent] text = '" << e->text() << "'" << endl; e->accept(); } // ---------------------------------------------------------------------------- -void KTouch::imComposeEvent(QIMEvent *e) { +void KTouch::imComposeEvent(TQIMEvent *e) { kdDebug() << "[KTouch::imComposeEvent] text = '" << e->text() << "'" << endl; e->accept(); } // ---------------------------------------------------------------------------- -void KTouch::imEndEvent(QIMEvent *e) { +void KTouch::imEndEvent(TQIMEvent *e) { kdDebug() << "[KTouch::imEndEvent] text = '" << e->text() << "'" << endl; if (!e->text().isEmpty()) { if (e->text() == "^") { - QKeyEvent *ev = new QKeyEvent (QEvent::KeyPress, + TQKeyEvent *ev = new TQKeyEvent (TQEvent::KeyPress, Qt::Key_AsciiCircum, '^', 0, - QString("^")); + TQString("^")); keyPressEvent(ev); delete ev; } diff --git a/ktouch/src/ktouch.h b/ktouch/src/ktouch.h index 9ebdcfc8..6bbe4325 100644 --- a/ktouch/src/ktouch.h +++ b/ktouch/src/ktouch.h @@ -17,9 +17,9 @@ #include <config.h> #endif -#include <qcolor.h> -#include <qstringlist.h> -#include <qvaluevector.h> +#include <tqcolor.h> +#include <tqstringlist.h> +#include <tqvaluevector.h> #include <kmainwindow.h> #include <kapplication.h> @@ -65,13 +65,13 @@ class KTouch : public KMainWindow { ~KTouch(); /// Returns the available lecture files - const QStringList& lectureFiles() const { return m_lectureFiles; } + const TQStringList& lectureFiles() const { return m_lectureFiles; } /// Returns the statistics object for the current lecture (as reference) KTouchLectureStats& getCurrentLectureStats(); /// Clears the statistics data. void clearStatistics(); /// Updates the status bar text. - void changeStatusbarMessage(const QString& text); + void changeStatusbarMessage(const TQString& text); /// Updates the status bar statistics. void changeStatusbarStats(unsigned int level_correct, unsigned int level_total, unsigned int level_words, unsigned int session_correct, unsigned int session_total, unsigned int session_words); @@ -111,11 +111,11 @@ class KTouch : public KMainWindow { /// Reimplementated to save preferences and bool queryExit(); /// Some layout fixes here... - void resizeEvent(QResizeEvent *); + void resizeEvent(TQResizeEvent *); /// Accepts a typed char. - void keyPressEvent(QKeyEvent *keyEvent); + void keyPressEvent(TQKeyEvent *keyEvent); - void imEndEvent (QIMEvent *e); + void imEndEvent (TQIMEvent *e); private: // *** BEGIN - Session management *** @@ -164,14 +164,14 @@ class KTouch : public KMainWindow { KTouchPrefKeyboardLayout * m_pageKeyboard; ///< The keyboard configuration page. KTouchPrefColorsLayout * m_pageColors; ///< The color scheme configuration page. - QStringList m_lectureFiles; ///< A list of all default lecture files. - QStringList m_lectureTitles; ///< A list of the titles of all default lecture files. + TQStringList m_lectureFiles; ///< A list of all default lecture files. + TQStringList m_lectureTitles; ///< A list of the titles of all default lecture files. - QStringList m_examinationFiles; ///< A list of all default examination files. - QStringList m_examinationTitles; ///< A list of the titles of all default examination files. + TQStringList m_examinationFiles; ///< A list of all default examination files. + TQStringList m_examinationTitles; ///< A list of the titles of all default examination files. - QStringList m_keyboardFiles; ///< A list of all default keyboard layout files. - QStringList m_keyboardTitles; ///< A list of the titles of all default keyboard layout files. + TQStringList m_keyboardFiles; ///< A list of all default keyboard layout files. + TQStringList m_keyboardTitles; ///< A list of the titles of all default keyboard layout files. KTouchStatisticsData m_stats; ///< All user statistics are kept here. diff --git a/ktouch/src/ktouchchartwidget.cpp b/ktouch/src/ktouchchartwidget.cpp index aba87f28..43e3642a 100644 --- a/ktouch/src/ktouchchartwidget.cpp +++ b/ktouch/src/ktouchchartwidget.cpp @@ -13,19 +13,19 @@ #include "ktouchchartwidget.h" #include "ktouchchartwidget.moc" -#include <qpainter.h> +#include <tqpainter.h> #include <klocale.h> #include <numeric> // for mathematical functions #include <cmath> -KTouchChartWidget::KTouchChartWidget(QWidget* parent, const char *name) +KTouchChartWidget::KTouchChartWidget(TQWidget* parent, const char *name) : KPlotWidget(0.0, 1.0, 0.0, 1.0, parent, name) { setShowGrid( false ); // no grid please - setBGColor( QColor( "white" ) ); - setFGColor( QColor( "black" ) ); + setBGColor( TQColor( "white" ) ); + setFGColor( TQColor( "black" ) ); setLimits( 0.0, 120.0, 0.0, 240.0 ); setXAxisLabel( i18n( "Progress" ) ); setYAxisLabel( i18n( "Words per second" ) ); diff --git a/ktouch/src/ktouchchartwidget.h b/ktouch/src/ktouchchartwidget.h index 223705b0..799a5a38 100644 --- a/ktouch/src/ktouchchartwidget.h +++ b/ktouch/src/ktouchchartwidget.h @@ -26,7 +26,7 @@ class KTouchChartWidget : public KPlotWidget { Q_OBJECT public: /// Constructor. - KTouchChartWidget(QWidget* parent, const char *name=0); + KTouchChartWidget(TQWidget* parent, const char *name=0); /// Destructor. ~KTouchChartWidget(); }; diff --git a/ktouch/src/ktouchcoloreditor.cpp b/ktouch/src/ktouchcoloreditor.cpp index 1341366d..e9bdb829 100644 --- a/ktouch/src/ktouchcoloreditor.cpp +++ b/ktouch/src/ktouchcoloreditor.cpp @@ -13,8 +13,8 @@ #include "ktouchcoloreditor.h" #include "ktouchcoloreditor.moc" -#include <qlistbox.h> -#include <qgroupbox.h> +#include <tqlistbox.h> +#include <tqgroupbox.h> #include <kcolorbutton.h> #include <kdebug.h> @@ -23,7 +23,7 @@ #include <klocale.h> #include <kmessagebox.h> -KTouchColorEditor::KTouchColorEditor(QWidget* parent, const char* name, bool modal, WFlags fl) +KTouchColorEditor::KTouchColorEditor(TQWidget* parent, const char* name, bool modal, WFlags fl) : KTouchColorEditorDlg(parent,name, modal,fl) { } @@ -34,7 +34,7 @@ KTouchColorEditor::~KTouchColorEditor() } // ---------------------------------------------------------------------------- -void KTouchColorEditor::startEditor(QValueList<KTouchColorScheme>& schemes, int active, int & selected) { +void KTouchColorEditor::startEditor(TQValueList<KTouchColorScheme>& schemes, int active, int & selected) { m_schemes = schemes; m_currentItem = QMAX(0, active); updateListBox(); @@ -54,14 +54,14 @@ void KTouchColorEditor::startEditor(QValueList<KTouchColorScheme>& schemes, int } // ---------------------------------------------------------------------------- -void KTouchColorEditor::colorSchemeChanged(QListBoxItem *) { +void KTouchColorEditor::colorSchemeChanged(TQListBoxItem *) { // kdDebug() << "[KTouchColorEditor::colorSchemeChanged]" << endl; int num = schemeListBox->currentItem(); if (num < 0 || num >= static_cast<int>(m_schemes.count())) { updateControls(NULL); return; } - QValueList<KTouchColorScheme>::const_iterator it = m_schemes.begin(); + TQValueList<KTouchColorScheme>::const_iterator it = m_schemes.begin(); while (--num >= 0) ++it; updateControls(&(*it)); } @@ -75,7 +75,7 @@ void KTouchColorEditor::updateClicked() { updateListBox(); return; } - QValueList<KTouchColorScheme>::iterator it = m_schemes.begin(); + TQValueList<KTouchColorScheme>::iterator it = m_schemes.begin(); while (--num >= 0) ++it; (*it).m_name = nameEdit->text(); if ((*it).m_name.isEmpty()) @@ -116,7 +116,7 @@ void KTouchColorEditor::removeBtnClicked() { int num = schemeListBox->currentItem(); int old_num = num; if (num >=0 && num < static_cast<int>(m_schemes.count())) { - QValueList<KTouchColorScheme>::iterator it = m_schemes.begin(); + TQValueList<KTouchColorScheme>::iterator it = m_schemes.begin(); while (--num >= 0) ++it; m_schemes.erase(it); } @@ -136,7 +136,7 @@ void KTouchColorEditor::addBtnClicked() { } // ---------------------------------------------------------------------------- -void KTouchColorEditor::closeEvent( QCloseEvent* ce ) { +void KTouchColorEditor::closeEvent( TQCloseEvent* ce ) { int result = KMessageBox::questionYesNoCancel(this, i18n("Save modified color schemes?")); switch (result) { @@ -154,7 +154,7 @@ void KTouchColorEditor::closeEvent( QCloseEvent* ce ) { void KTouchColorEditor::updateListBox() { // kdDebug() << "[KTouchColorEditor::updateListBox]" << endl; schemeListBox->clear(); - for (QValueList<KTouchColorScheme>::const_iterator it = m_schemes.constBegin(); + for (TQValueList<KTouchColorScheme>::const_iterator it = m_schemes.constBegin(); it != m_schemes.constEnd(); ++it) { schemeListBox->insertItem( (*it).m_name ); diff --git a/ktouch/src/ktouchcoloreditor.h b/ktouch/src/ktouchcoloreditor.h index 3d5a0e11..9e826e94 100644 --- a/ktouch/src/ktouchcoloreditor.h +++ b/ktouch/src/ktouchcoloreditor.h @@ -19,7 +19,7 @@ #include "ktouchcoloreditor_dlg.h" -#include <qvaluelist.h> +#include <tqvaluelist.h> #include "ktouchcolorscheme.h" @@ -30,7 +30,7 @@ class KTouchColorEditor : public KTouchColorEditorDlg public: /// Constructor - KTouchColorEditor(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + KTouchColorEditor(TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); /// Destructor ~KTouchColorEditor(); @@ -38,16 +38,16 @@ public: /// @param schemes List with user defined color schemes. /// @param active Index with active color scheme (negative if predefined scheme is active). /// @param selected Here the index of the currently selected scheme is stored. - void startEditor(QValueList<KTouchColorScheme>& schemes, int active, int & selected); + void startEditor(TQValueList<KTouchColorScheme>& schemes, int active, int & selected); public slots: - virtual void colorSchemeChanged(QListBoxItem * item); + virtual void colorSchemeChanged(TQListBoxItem * item); virtual void updateClicked(); virtual void removeBtnClicked(); virtual void addBtnClicked(); protected: - virtual void closeEvent( QCloseEvent* ce ); + virtual void closeEvent( TQCloseEvent* ce ); private: /// Updates the list box with values from m_schemes. @@ -57,7 +57,7 @@ private: void updateControls(const KTouchColorScheme * cs); int m_currentItem; - QValueList<KTouchColorScheme> m_schemes; + TQValueList<KTouchColorScheme> m_schemes; bool m_saveChanges; }; diff --git a/ktouch/src/ktouchcolorscheme.cpp b/ktouch/src/ktouchcolorscheme.cpp index 0092fb07..9a20d2e9 100644 --- a/ktouch/src/ktouchcolorscheme.cpp +++ b/ktouch/src/ktouchcolorscheme.cpp @@ -11,9 +11,9 @@ #include "ktouchcolorscheme.h" -#include <qfile.h> -#include <qtextstream.h> -#include <qdom.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqdom.h> #include <kdebug.h> #include <klocale.h> @@ -26,24 +26,24 @@ z.appendChild(e); #define READ_COLOR(x,y) c = n.namedItem(x); \ - if (!c.isNull()) y = QColor(c.firstChild().nodeValue()); + if (!c.isNull()) y = TQColor(c.firstChild().nodeValue()); -QValueVector<KTouchColorScheme> KTouchColorScheme::m_colorSchemes; +TQValueVector<KTouchColorScheme> KTouchColorScheme::m_colorSchemes; void KTouchColorScheme::clear() { // the default scheme is the classic one - m_teacherTextColor = QColor("#000032"); - m_teacherBackground = QColor("#BEBEFF"); - m_studentTextColor = QColor("#003200"); - m_studentBackground = QColor("#9FFF9F"); + m_teacherTextColor = TQColor("#000032"); + m_teacherBackground = TQColor("#BEBEFF"); + m_studentTextColor = TQColor("#003200"); + m_studentBackground = TQColor("#9FFF9F"); m_errorTextColor = Qt::white; - m_errorBackground = QColor("#AC0000"); + m_errorBackground = TQColor("#AC0000"); m_frame = Qt::black; - m_background[0] = QColor(255,238, 7); m_background[4] = QColor(247,138,247); - m_background[1] = QColor( 14,164,239); m_background[5] = QColor(158,255,155); - m_background[2] = QColor(158,255,155); m_background[6] = QColor( 14,164,239); - m_background[3] = QColor(252,138,138); m_background[7] = QColor(255,238, 7); + m_background[0] = TQColor(255,238, 7); m_background[4] = TQColor(247,138,247); + m_background[1] = TQColor( 14,164,239); m_background[5] = TQColor(158,255,155); + m_background[2] = TQColor(158,255,155); m_background[6] = TQColor( 14,164,239); + m_background[3] = TQColor(252,138,138); m_background[7] = TQColor(255,238, 7); m_text = Qt::black; m_backgroundH = Qt::darkBlue; m_textH = Qt::white; @@ -56,18 +56,18 @@ void KTouchColorScheme::clear() { } // ---------------------------------------------------------------------------- -bool KTouchColorScheme::read(const QDomNode& node) { +bool KTouchColorScheme::read(const TQDomNode& node) { // kdDebug() << "[KTouchColorScheme::read] " << endl; - QDomNode name = node.namedItem("Name"); + TQDomNode name = node.namedItem("Name"); if (name.isNull()) m_name = i18n("untitled color scheme"); else m_name = name.firstChild().nodeValue(); // kdDebug() << " Reading scheme = " << m_name << endl; - QDomNode n = node.namedItem("LineColors"); + TQDomNode n = node.namedItem("LineColors"); if (!n.isNull()) { - QDomNode c; + TQDomNode c; READ_COLOR("TeacherTextColor", m_teacherTextColor); READ_COLOR("TeacherBackground", m_teacherBackground); READ_COLOR("StudentTextColor", m_studentTextColor); @@ -78,10 +78,10 @@ bool KTouchColorScheme::read(const QDomNode& node) { n = node.namedItem("KeyboardColors"); if (!n.isNull()) { - QDomNode c; + TQDomNode c; READ_COLOR("KeyFrame", m_frame); for (unsigned int i=0; i<8; ++i) { - READ_COLOR(QString("KeyBack_%1").arg(i), m_background[i]); + READ_COLOR(TQString("KeyBack_%1").arg(i), m_background[i]); } READ_COLOR("KeyText", m_text); READ_COLOR("KeyBackHigh", m_backgroundH); @@ -95,20 +95,20 @@ bool KTouchColorScheme::read(const QDomNode& node) { } // ---------------------------------------------------------------------------- -void KTouchColorScheme::write(QDomDocument& doc, QDomElement& root) const { +void KTouchColorScheme::write(TQDomDocument& doc, TQDomElement& root) const { //kdDebug() << "[KTouchColorScheme::write] " << endl; - QDomElement element = doc.createElement("KTouchColorScheme"); + TQDomElement element = doc.createElement("KTouchColorScheme"); // append name of color scheme - QDomElement name = doc.createElement("Name"); - QDomText name_text; + TQDomElement name = doc.createElement("Name"); + TQDomText name_text; if (m_name.isEmpty()) name_text = doc.createTextNode( i18n("untitled color scheme") ); else name_text = doc.createTextNode(m_name); name.appendChild(name_text); element.appendChild(name); // store slide line colors - QDomElement line_colors = doc.createElement("LineColors"); - QDomElement e; - QDomText n; + TQDomElement line_colors = doc.createElement("LineColors"); + TQDomElement e; + TQDomText n; WRITE_COLOR(line_colors, "TeacherTextColor", m_teacherTextColor); WRITE_COLOR(line_colors, "TeacherBackground", m_teacherBackground); @@ -121,11 +121,11 @@ void KTouchColorScheme::write(QDomDocument& doc, QDomElement& root) const { // done with slide line colors // write key drawing colors - QDomElement key_colors = doc.createElement("KeyboardColors"); + TQDomElement key_colors = doc.createElement("KeyboardColors"); WRITE_COLOR(key_colors, "KeyFrame", m_frame); for (unsigned int i=0; i<8; ++i) { - WRITE_COLOR(key_colors, QString("KeyBack_%1").arg(i), m_background[i]); + WRITE_COLOR(key_colors, TQString("KeyBack_%1").arg(i), m_background[i]); } WRITE_COLOR(key_colors, "KeyText", m_text); WRITE_COLOR(key_colors, "KeyBackHigh", m_backgroundH); @@ -142,23 +142,23 @@ void KTouchColorScheme::write(QDomDocument& doc, QDomElement& root) const { } // ---------------------------------------------------------------------------- -bool KTouchColorScheme::readList(QWidget * window, const KURL& url) { +bool KTouchColorScheme::readList(TQWidget * window, const KURL& url) { if (url.isEmpty()) return false; //kdDebug() << "[KTouchColorScheme::readList] " << endl; //kdDebug() << " url = '" << url.url() << "'" << endl; - QString tmp_file; + TQString tmp_file; bool result = KIO::NetAccess::download(url, tmp_file, window); if (result) { // Ok, that was successful, try to parse the XML doc now - QFile infile(tmp_file); + TQFile infile(tmp_file); if ( !infile.open( IO_ReadOnly ) ) { KIO::NetAccess::removeTempFile(tmp_file); return false; // Bugger it... couldn't open it... } - QDomDocument doc; + TQDomDocument doc; doc.setContent( &infile ); // read the document - QDomNodeList schemes = doc.elementsByTagName("KTouchColorScheme"); + TQDomNodeList schemes = doc.elementsByTagName("KTouchColorScheme"); int num = schemes.count(); if (num > 0) { //kdDebug() << " reading " << schemes.count() << " color maps..." << endl; @@ -176,20 +176,20 @@ bool KTouchColorScheme::readList(QWidget * window, const KURL& url) { } // ---------------------------------------------------------------------------- -bool KTouchColorScheme::writeList(QWidget * window, const KURL& url) { +bool KTouchColorScheme::writeList(TQWidget * window, const KURL& url) { // create the XML document and root node - QDomDocument doc; - QDomElement root = doc.createElement( "KTouchColorSchemeCollection" ); + TQDomDocument doc; + TQDomElement root = doc.createElement( "KTouchColorSchemeCollection" ); doc.appendChild(root); // write all the non-default color schemes - for (QValueVector<KTouchColorScheme>::const_iterator it = m_colorSchemes.constBegin(); + for (TQValueVector<KTouchColorScheme>::const_iterator it = m_colorSchemes.constBegin(); it != m_colorSchemes.constEnd(); ++it) { if (!it->m_default) it->write(doc, root); } // and save it - QString tmp_file; + TQString tmp_file; KTempFile *temp=0; if (url.isLocalFile()) tmp_file=url.path(); // for local files the path is sufficient @@ -199,14 +199,14 @@ bool KTouchColorScheme::writeList(QWidget * window, const KURL& url) { tmp_file=temp->name(); } - QFile outfile(tmp_file); + TQFile outfile(tmp_file); if ( !outfile.open( IO_WriteOnly ) ) { if (temp) delete temp; kdDebug() << "Error creating tmp file '"+tmp_file+"' for writing color map!" << endl; return false; } - QTextStream out( &outfile ); + TQTextStream out( &outfile ); out << doc.toString(); outfile.close(); // if we have a temporary file, we still need to upload it @@ -243,17 +243,17 @@ void KTouchColorScheme::createDefaults() { m_colorSchemes.push_back(color); color.m_name = i18n("Classic"); - color.m_teacherTextColor = QColor("#000032"); - color.m_teacherBackground = QColor("#BEBEFF"); - color.m_studentTextColor = QColor("#003200"); - color.m_studentBackground = QColor("#9FFF9F"); + color.m_teacherTextColor = TQColor("#000032"); + color.m_teacherBackground = TQColor("#BEBEFF"); + color.m_studentTextColor = TQColor("#003200"); + color.m_studentBackground = TQColor("#9FFF9F"); color.m_errorTextColor = Qt::white; - color.m_errorBackground = QColor("#AC0000"); + color.m_errorBackground = TQColor("#AC0000"); color.m_frame = Qt::black; - color.m_background[0] = QColor(255,238, 7); color.m_background[4] = QColor(247,138,247); - color.m_background[1] = QColor( 14,164,239); color.m_background[5] = QColor(158,255,155); - color.m_background[2] = QColor(158,255,155); color.m_background[6] = QColor( 14,164,239); - color.m_background[3] = QColor(252,138,138); color.m_background[7] = QColor(255,238, 7); + color.m_background[0] = TQColor(255,238, 7); color.m_background[4] = TQColor(247,138,247); + color.m_background[1] = TQColor( 14,164,239); color.m_background[5] = TQColor(158,255,155); + color.m_background[2] = TQColor(158,255,155); color.m_background[6] = TQColor( 14,164,239); + color.m_background[3] = TQColor(252,138,138); color.m_background[7] = TQColor(255,238, 7); color.m_text = Qt::black; color.m_backgroundH = Qt::darkBlue; color.m_textH = Qt::white; @@ -265,43 +265,43 @@ void KTouchColorScheme::createDefaults() { color.m_name = i18n("Deep Blue"); color.m_teacherTextColor = Qt::white; - color.m_teacherBackground = QColor( 0, 39, 80); + color.m_teacherBackground = TQColor( 0, 39, 80); color.m_studentTextColor = Qt::white; - color.m_studentBackground = QColor( 39, 59,127); - color.m_errorTextColor = QColor("#B5CFFF"); - color.m_errorBackground = QColor("#640000"); - color.m_frame = QColor(220,220,220); - color.m_background[0] = QColor( 0, 39, 80); color.m_background[4] = QColor( 24, 19, 72); - color.m_background[1] = QColor( 39, 59,127); color.m_background[5] = QColor( 8, 44,124); - color.m_background[2] = QColor( 4, 39, 53); color.m_background[6] = QColor( 10, 82,158); - color.m_background[3] = QColor( 40, 32,121); color.m_background[7] = QColor( 43, 60,124); + color.m_studentBackground = TQColor( 39, 59,127); + color.m_errorTextColor = TQColor("#B5CFFF"); + color.m_errorBackground = TQColor("#640000"); + color.m_frame = TQColor(220,220,220); + color.m_background[0] = TQColor( 0, 39, 80); color.m_background[4] = TQColor( 24, 19, 72); + color.m_background[1] = TQColor( 39, 59,127); color.m_background[5] = TQColor( 8, 44,124); + color.m_background[2] = TQColor( 4, 39, 53); color.m_background[6] = TQColor( 10, 82,158); + color.m_background[3] = TQColor( 40, 32,121); color.m_background[7] = TQColor( 43, 60,124); color.m_text = Qt::white; - color.m_backgroundH = QColor(125,180,255); + color.m_backgroundH = TQColor(125,180,255); color.m_textH = Qt::darkBlue; color.m_cBackground = Qt::black; color.m_cText = Qt::white; - color.m_cBackgroundH = QColor(111,121,73); + color.m_cBackgroundH = TQColor(111,121,73); color.m_cTextH = Qt::white; m_colorSchemes.push_back(color); color.m_name = i18n("Stripy"); color.m_teacherTextColor = Qt::white; - color.m_teacherBackground = QColor( 39, 70, 227); + color.m_teacherBackground = TQColor( 39, 70, 227); color.m_studentTextColor = Qt::white; - color.m_studentBackground = QColor( 39, 70, 127); + color.m_studentBackground = TQColor( 39, 70, 127); color.m_errorTextColor = Qt::white; color.m_errorBackground = Qt::darkGray; color.m_frame = Qt::black; for (int i=0; i<8; i=i+2) - color.m_background[i] = QColor( 39, 70, 127); + color.m_background[i] = TQColor( 39, 70, 127); for (int i=1; i<8; i=i+2) color.m_background[i] = Qt::darkGray; color.m_text = Qt::black; - color.m_backgroundH = QColor( 39, 70, 227); + color.m_backgroundH = TQColor( 39, 70, 227); color.m_textH = Qt::white; color.m_cBackground = Qt::gray; color.m_cText = Qt::black; - color.m_cBackgroundH = QColor( 39, 70, 227); + color.m_cBackgroundH = TQColor( 39, 70, 227); color.m_cTextH = Qt::black; m_colorSchemes.push_back(color); } diff --git a/ktouch/src/ktouchcolorscheme.h b/ktouch/src/ktouchcolorscheme.h index 47e28813..471dbe55 100644 --- a/ktouch/src/ktouchcolorscheme.h +++ b/ktouch/src/ktouchcolorscheme.h @@ -16,8 +16,8 @@ #include <config.h> #endif -#include <qcolor.h> -#include <qvaluevector.h> +#include <tqcolor.h> +#include <tqvaluevector.h> #include <kurl.h> @@ -36,29 +36,29 @@ class KTouchColorScheme { void clear(); /// Loads a color map (in XML format) from XML node (returns true if successful) - bool read(const QDomNode& node); + bool read(const TQDomNode& node); /// Saves a color map to XML document (returns true if successful). - void write(QDomDocument& doc, QDomElement& root) const; + void write(TQDomDocument& doc, TQDomElement& root) const; - QString m_name; ///< The name of the colour scheme. + TQString m_name; ///< The name of the colour scheme. - QColor m_teacherTextColor; ///< The text colour for the teachers line. - QColor m_teacherBackground; ///< The background colour for the teachers line. - QColor m_studentTextColor; ///< The text colour for the students line. - QColor m_studentBackground; ///< The background colour for the students line. - QColor m_errorTextColor; ///< The text colour for wrong text (students line). - QColor m_errorBackground; ///< The background colour for wrong text (students line). + TQColor m_teacherTextColor; ///< The text colour for the teachers line. + TQColor m_teacherBackground; ///< The background colour for the teachers line. + TQColor m_studentTextColor; ///< The text colour for the students line. + TQColor m_studentBackground; ///< The background colour for the students line. + TQColor m_errorTextColor; ///< The text colour for wrong text (students line). + TQColor m_errorBackground; ///< The background colour for wrong text (students line). - QColor m_frame; ///< The colour for the key frames. - QColor m_background[8]; ///< The background colour of the finger keys and the associated normal keys. - QColor m_text; ///< The colour for the text on the keys. - QColor m_backgroundH; ///< The background colour for highlighted (next) normal keys. - QColor m_textH; ///< The text/pen colour for highlighted (next) normal keys. - QColor m_cBackground; ///< The background colour for the control keys. - QColor m_cText; ///< The text/pen colour for the control keys. - QColor m_cBackgroundH; ///< The background colour for activated control keys. - QColor m_cTextH; ///< The text/pen colour for activated control keys. + TQColor m_frame; ///< The colour for the key frames. + TQColor m_background[8]; ///< The background colour of the finger keys and the associated normal keys. + TQColor m_text; ///< The colour for the text on the keys. + TQColor m_backgroundH; ///< The background colour for highlighted (next) normal keys. + TQColor m_textH; ///< The text/pen colour for highlighted (next) normal keys. + TQColor m_cBackground; ///< The background colour for the control keys. + TQColor m_cText; ///< The text/pen colour for the control keys. + TQColor m_cBackgroundH; ///< The background colour for activated control keys. + TQColor m_cTextH; ///< The text/pen colour for activated control keys. bool m_default; ///< If true, this color map is marked as default and will not /// be saved in the XML file. @@ -68,14 +68,14 @@ class KTouchColorScheme { /// Loads several color maps (in XML format) from file (returns true if successful) /// and _adds_ them to the current color maps. This function shall be called /// directly after createDefaultColorSchemes(). - static bool readList(QWidget * window, const KURL& url); + static bool readList(TQWidget * window, const KURL& url); /// Saves several color maps to file (returns true if successful). /// Only non-default color maps are written to file. - static bool writeList(QWidget * window, const KURL& url); + static bool writeList(TQWidget * window, const KURL& url); /// Creates some default color schemes (erases m_colorSchemes before). static void createDefaults(); /// Contains all color schemes available in the program. - static QValueVector<KTouchColorScheme> m_colorSchemes; + static TQValueVector<KTouchColorScheme> m_colorSchemes; }; #endif // KTOUCHCOLORSCHEME_H diff --git a/ktouch/src/ktouchkey.cpp b/ktouch/src/ktouchkey.cpp index cb68b214..befc1675 100644 --- a/ktouch/src/ktouchkey.cpp +++ b/ktouch/src/ktouchkey.cpp @@ -14,7 +14,7 @@ #include <kdebug.h> #include <utility> // for std::min -KTouchKey::KTouchKey(keytype_t type, int x, int y, int w, int h, QChar ch) +KTouchKey::KTouchKey(keytype_t type, int x, int y, int w, int h, TQChar ch) : m_type(type), m_x(x), m_y(y), m_w(w), m_h(h) { m_chars[0].m_ch = ch; @@ -23,7 +23,7 @@ KTouchKey::KTouchKey(keytype_t type, int x, int y, int w, int h, QChar ch) } // ---------------------------------------------------------------------------- -KTouchKey::KTouchKey(int x, int y, int w, int h, QString text) : +KTouchKey::KTouchKey(int x, int y, int w, int h, TQString text) : m_x(x), m_y(y), m_w(w), m_h(h) { m_type = OTHER; @@ -44,16 +44,16 @@ void KTouchKey::resize(double scale) { // Reads the key data from the DomElement -bool KTouchKey::read(QDomNode node) { +bool KTouchKey::read(TQDomNode node) { /* if (node.isNull()) return false; // TODO : Error message - QString primaryCharText = node.firstChild().nodeValue(); + TQString primaryCharText = node.firstChild().nodeValue(); if (primaryCharText.length() >= 1) m_primaryChar = primaryCharText[0]; else return false; // TODO : Error message - QDomNamedNodeMap nmap = node.attributes(); + TQDomNamedNodeMap nmap = node.attributes(); // Get height, widht, x and y node = nmap.namedItem("Height"); if (node.isNull()) @@ -75,7 +75,7 @@ bool KTouchKey::read(QDomNode node) { node = nmap.namedItem("Type"); if (node.isNull()) return false; // TODO : Error message - QString typetext = node.nodeValue(); + TQString typetext = node.nodeValue(); if (typetext=="NORMAL") m_type = NORMAL; else if (typetext=="FINGER") m_type = FINGER; else if (typetext=="ENTER") m_type = ENTER; @@ -92,13 +92,13 @@ bool KTouchKey::read(QDomNode node) { return false; // TODO : Error message // read optional secondary character node = nmap.namedItem("SecondaryChar"); - QString charvalue; + TQString charvalue; if (!node.isNull()) charvalue = node.nodeValue(); if (charvalue.length() >= 1) m_secondaryChar = charvalue[0]; else - m_secondaryChar = QChar(0); + m_secondaryChar = TQChar(0); kdDebug() << "H:" << m_h << " W:" << m_w << " X:" << m_x << " Y:" << m_y << " Type:" << m_type << " SecondaryChar:" << m_secondaryChar << "' PrimaryChar:" << m_primaryChar << "'" << endl; @@ -108,9 +108,9 @@ bool KTouchKey::read(QDomNode node) { // ---------------------------------------------------------------------------- // Writes the key data into the DomElement -void KTouchKey::write(QDomDocument& doc, QDomElement& root) const { +void KTouchKey::write(TQDomDocument& doc, TQDomElement& root) const { /* - QDomElement element = doc.createElement("KeyDefinition"); + TQDomElement element = doc.createElement("KeyDefinition"); switch (m_type) { case NORMAL : element.setAttribute("Type", "NORMAL"); break; case FINGER : element.setAttribute("Type", "FINGER"); break; @@ -123,11 +123,11 @@ void KTouchKey::write(QDomDocument& doc, QDomElement& root) const { element.setAttribute("OtherKeyText", m_otherKeyText); break; } - QDomText charnode = doc.createTextNode(QString(m_primaryChar)); + TQDomText charnode = doc.createTextNode(TQString(m_primaryChar)); element.appendChild(charnode); -// element.setAttribute("PrimaryChar", QString(m_primaryChar)); - if (m_secondaryChar!=QChar(0)) - element.setAttribute("SecondaryChar", QString(m_secondaryChar)); +// element.setAttribute("PrimaryChar", TQString(m_primaryChar)); + if (m_secondaryChar!=TQChar(0)) + element.setAttribute("SecondaryChar", TQString(m_secondaryChar)); element.setAttribute("X", m_x); element.setAttribute("Y", m_y); element.setAttribute("Width", m_w); diff --git a/ktouch/src/ktouchkey.h b/ktouch/src/ktouchkey.h index f27fd80f..011f4e4b 100644 --- a/ktouch/src/ktouchkey.h +++ b/ktouch/src/ktouchkey.h @@ -17,8 +17,8 @@ #include <config.h> #endif -#include <qpainter.h> -#include <qdom.h> +#include <tqpainter.h> +#include <tqdom.h> /// This class contains information about one character on a key. class KTouchKeyChar { @@ -34,10 +34,10 @@ class KTouchKeyChar { /// Constructor. KTouchKeyChar() {} /// Constructor. - KTouchKeyChar(QChar ch, position_t p, bool bold = false) : + KTouchKeyChar(TQChar ch, position_t p, bool bold = false) : m_ch(ch), m_pos(p), m_bold(bold) {} - QChar m_ch; ///< The character to draw. + TQChar m_ch; ///< The character to draw. position_t m_pos; ///< The position of the character. bool m_bold; ///< Whether this is a bold character. @@ -65,17 +65,17 @@ class KTouchKey { /// Default constructor KTouchKey() : m_type(NORMAL), m_x(0), m_y(0), m_w(0), m_h(0) {} /// Convenience constructor for a key with a single character (like before). - KTouchKey(keytype_t type, int x, int y, int w, int h, QChar ch); + KTouchKey(keytype_t type, int x, int y, int w, int h, TQChar ch); /// Convenience constructor for a key with a text on it (type will be OTHER). - KTouchKey(int x, int y, int w, int h, QString text); + KTouchKey(int x, int y, int w, int h, TQString text); /// Resizes the key (this function will be obsolete soon) void resize(double scale); /// Reads the key data from the DomElement - bool read(QDomNode node); + bool read(TQDomNode node); /// Creates a new DomElement, writes the key data into it and appends it to the root object. - void write(QDomDocument& doc, QDomElement& root) const; + void write(TQDomDocument& doc, TQDomElement& root) const; unsigned int m_number; ///< The number of the key. keytype_t m_type; ///< The type of the key. diff --git a/ktouch/src/ktouchkeyboard.cpp b/ktouch/src/ktouchkeyboard.cpp index a9650f9e..1e7440a5 100644 --- a/ktouch/src/ktouchkeyboard.cpp +++ b/ktouch/src/ktouchkeyboard.cpp @@ -12,7 +12,7 @@ #include "ktouchkeyboard.h" -#include <qfile.h> +#include <tqfile.h> #include <kdebug.h> #include <ktempfile.h> @@ -27,26 +27,26 @@ void KTouchKeyboard::clear() { m_keys.clear(); m_connectors.clear(); - m_title = QString::null; - m_comment = QString::null; - m_language = QString::null; - m_fontSuggestions = QString::null; + m_title = TQString::null; + m_comment = TQString::null; + m_language = TQString::null; + m_fontSuggestions = TQString::null; } // ---------------------------------------------------------------------------- // Loads a keyboard layout (old format) from file (returns true if successful). -bool KTouchKeyboard::load(QWidget * window, const KURL& url) { +bool KTouchKeyboard::load(TQWidget * window, const KURL& url) { // Ok, first download the contents as usual using the KIO lib // File is only downloaded if not local, otherwise it's just opened - QString target; + TQString target; bool result = false; //kdDebug() << "[KTouchKeyboard::load] " << url << endl; if (KIO::NetAccess::download(url, target, window)) { // Ok, that was successful, store the lectureURL and read the file - QFile infile(target); + TQFile infile(target); if ( !infile.open( IO_ReadOnly ) ) return false; // Bugger it... couldn't open it... - QTextStream in( &infile ); + TQTextStream in( &infile ); result = read(in); }; KIO::NetAccess::removeTempFile(target); @@ -55,17 +55,17 @@ bool KTouchKeyboard::load(QWidget * window, const KURL& url) { // ---------------------------------------------------------------------------- // Loads a lecture (in XML format) from file (returns true if successful). -bool KTouchKeyboard::loadXML(QWidget * window, const KURL& url) { +bool KTouchKeyboard::loadXML(TQWidget * window, const KURL& url) { // Ok, first download the contents as usual using the KIO lib // File is only downloaded if not local, otherwise it's just opened - QString target; + TQString target; bool result = false; if (KIO::NetAccess::download(url, target, window)) { // Ok, that was successful, store the lectureURL and read the file - QFile infile(target); + TQFile infile(target); if ( !infile.open( IO_ReadOnly ) ) return false; // Bugger it... couldn't open it... - QDomDocument doc; + TQDomDocument doc; doc.setContent( &infile ); result = read(doc); } @@ -75,13 +75,13 @@ bool KTouchKeyboard::loadXML(QWidget * window, const KURL& url) { // ---------------------------------------------------------------------------- // Saves the lecture data to file (returns true if successful). -bool KTouchKeyboard::saveXML(QWidget * window, const KURL& url) const { +bool KTouchKeyboard::saveXML(TQWidget * window, const KURL& url) const { // create the XML document - QDomDocument doc; + TQDomDocument doc; write(doc); // and save it - QString tmpFile; + TQString tmpFile; KTempFile *temp=0; if (url.isLocalFile()) tmpFile=url.path(); // for local files the path is sufficient @@ -91,14 +91,14 @@ bool KTouchKeyboard::saveXML(QWidget * window, const KURL& url) const { tmpFile=temp->name(); } - QFile outfile(tmpFile); + TQFile outfile(tmpFile); if ( !outfile.open( IO_WriteOnly ) ) { if (temp) delete temp; // kdDebug() << "Error creating lecture file!" << endl; return false; }; - QTextStream out( &outfile ); + TQTextStream out( &outfile ); out << doc.toString(); outfile.close(); // if we have a temporary file, we still need to upload it @@ -111,9 +111,9 @@ bool KTouchKeyboard::saveXML(QWidget * window, const KURL& url) const { // ---------------------------------------------------------------------------- // Loads keyboard data from file, preserved for compatibility -bool KTouchKeyboard::read(QTextStream& in) { - in.setEncoding(QTextStream::UnicodeUTF8); - QString line; +bool KTouchKeyboard::read(TQTextStream& in) { + in.setEncoding(TQTextStream::UnicodeUTF8); + TQString line; clear(); // empty the keyboard // now loop until end of file is reached do { @@ -124,10 +124,10 @@ bool KTouchKeyboard::read(QTextStream& in) { if (line.isNull()) continue; // 'line' should now contain a key specification - QTextStream lineStream(line, IO_ReadOnly); - QString keyType; + TQTextStream lineStream(line, IO_ReadOnly); + TQString keyType; int keyAscII; - QString keyText; + TQString keyText; int x(0), y(0), w(0), h(0); lineStream >> keyType >> keyAscII; if (keyType=="FingerKey") { @@ -174,14 +174,14 @@ bool KTouchKeyboard::read(QTextStream& in) { // ---------------------------------------------------------------------------- // Loads keyboard data from file into an XML document -bool KTouchKeyboard::read(const QDomDocument& doc) { +bool KTouchKeyboard::read(const TQDomDocument& doc) { // clean current data kdDebug() << "Reading new keyboard layout" << endl; m_keys.clear(); m_connectors.clear(); - m_title = QString::null; + m_title = TQString::null; // retrieve the title - QDomNodeList entries = doc.elementsByTagName("Title"); + TQDomNodeList entries = doc.elementsByTagName("Title"); if (entries.count() >= 1) m_title = entries.item(0).firstChild().nodeValue(); else m_title = i18n("untitled keyboard layout"); kdDebug() << "Title: " << m_title << endl; @@ -199,7 +199,7 @@ bool KTouchKeyboard::read(const QDomDocument& doc) { m_language = entries.item(0).firstChild().nodeValue(); // retrieve the key definitions entries = doc.elementsByTagName("KeyDefinitions"); - QDomNode node = entries.item(0).firstChild(); + TQDomNode node = entries.item(0).firstChild(); while (!node.isNull()) { KTouchKey key; if (key.read(node)) @@ -229,46 +229,46 @@ bool KTouchKeyboard::read(const QDomDocument& doc) { // ---------------------------------------------------------------------------- // Saves keyboard data in the XML document -void KTouchKeyboard::write(QDomDocument& doc) const { - QDomElement root = doc.createElement( "KTouchKeyboard" ); +void KTouchKeyboard::write(TQDomDocument& doc) const { + TQDomElement root = doc.createElement( "KTouchKeyboard" ); doc.appendChild(root); // Store title and ensure that the file contains a title! - QDomElement title = doc.createElement("Title"); - QDomText titleText; + TQDomElement title = doc.createElement("Title"); + TQDomText titleText; if (m_title.isEmpty()) titleText = doc.createTextNode( i18n("untitled keyboard layout") ); else titleText = doc.createTextNode(m_title); title.appendChild(titleText); root.appendChild(title); // Store comment if given if (!m_comment.isEmpty()) { - QDomElement e = doc.createElement("Comment"); - QDomText t = doc.createTextNode(m_comment); + TQDomElement e = doc.createElement("Comment"); + TQDomText t = doc.createTextNode(m_comment); e.appendChild(t); root.appendChild(e); } // Store font suggestion if given if (!m_fontSuggestions.isEmpty()) { - QDomElement e = doc.createElement("FontSuggestions"); - QDomText t = doc.createTextNode(m_fontSuggestions); + TQDomElement e = doc.createElement("FontSuggestions"); + TQDomText t = doc.createTextNode(m_fontSuggestions); e.appendChild(t); root.appendChild(e); } // Store language idif given if (!m_language.isEmpty()) { - QDomElement e = doc.createElement("Language"); - QDomText t = doc.createTextNode(m_language); + TQDomElement e = doc.createElement("Language"); + TQDomText t = doc.createTextNode(m_language); e.appendChild(t); root.appendChild(e); } // Store keys - QDomElement keys = doc.createElement("KeyDefinitions"); + TQDomElement keys = doc.createElement("KeyDefinitions"); root.appendChild(keys); - for (QValueVector<KTouchKey>::const_iterator it=m_keys.begin(); it!=m_keys.end(); ++it) + for (TQValueVector<KTouchKey>::const_iterator it=m_keys.begin(); it!=m_keys.end(); ++it) it->write(doc, keys); // Store connectors - QDomElement conns = doc.createElement("KeyConnections"); + TQDomElement conns = doc.createElement("KeyConnections"); root.appendChild(conns); - for (QValueVector<KTouchKeyConnector>::const_iterator it=m_connectors.begin(); it!=m_connectors.end(); ++it) + for (TQValueVector<KTouchKeyConnector>::const_iterator it=m_connectors.begin(); it!=m_connectors.end(); ++it) it->write(doc, conns); } // ---------------------------------------------------------------------------- @@ -328,7 +328,7 @@ void KTouchKeyboard::createDefault() { m_title = "Number keypad"; m_comment = "Predefined keyboard layout"; - m_language = QString::null; + m_language = TQString::null; // language does not apply to numbers... that's one of the nice things with math :-) m_fontSuggestions = "Monospace"; m_width = 8*col; @@ -337,7 +337,7 @@ void KTouchKeyboard::createDefault() { // ---------------------------------------------------------------------------- void KTouchKeyboard::updateConnections() { - for (QValueVector<KTouchKeyConnector>::iterator it = m_connectors.begin(); it != m_connectors.end(); ++it) + for (TQValueVector<KTouchKeyConnector>::iterator it = m_connectors.begin(); it != m_connectors.end(); ++it) (*it).updateConnections(m_keys); } // ---------------------------------------------------------------------------- @@ -345,10 +345,10 @@ void KTouchKeyboard::updateConnections() { /* -bool KTouchKeyboard::loadKeyboard(QWidget * window, const KURL& url, QString* errorMsg) { - QString target; +bool KTouchKeyboard::loadKeyboard(TQWidget * window, const KURL& url, TQString* errorMsg) { + TQString target; if (KIO::NetAccess::download(url, target, window)) { - QString msg; + TQString msg; bool result = readKeyboard(target, msg); KIO::NetAccess::removeTempFile(target); if (!result && errorMsg!=NULL) @@ -363,8 +363,8 @@ bool KTouchKeyboard::loadKeyboard(QWidget * window, const KURL& url, QString* er } -void KTouchKeyboard::saveKeyboard(QWidget * window, const KURL& url) { - QString tmpFile; +void KTouchKeyboard::saveKeyboard(TQWidget * window, const KURL& url) { + TQString tmpFile; KTempFile *temp=0; if (url.isLocalFile()) tmpFile=url.path(); // for local files the path is sufficient @@ -373,13 +373,13 @@ void KTouchKeyboard::saveKeyboard(QWidget * window, const KURL& url) { tmpFile=temp->name(); } - QFile outfile(tmpFile); + TQFile outfile(tmpFile); if ( !outfile.open( IO_WriteOnly ) ) { if (temp) delete temp; return; } - QTextStream out( &outfile ); + TQTextStream out( &outfile ); out << "########################################## \n"; out << "# # \n"; out << "# Keyboard layout file for KTouch # \n"; @@ -395,7 +395,7 @@ void KTouchKeyboard::saveKeyboard(QWidget * window, const KURL& url) { case KTouchKey::CONTROL_KEY : out << "ControlKey "; break; default : out << "NormalKey "; break; } - QRect rect=key->frame(); + TQRect rect=key->frame(); out << key->m_keyChar.unicode() << '\t' << key->m_keyText << '\t' << rect.left() << '\t' << rect.top() << '\t' << rect.width() << '\t' << rect.height() << endl; } @@ -407,7 +407,7 @@ void KTouchKeyboard::saveKeyboard(QWidget * window, const KURL& url) { } } -void KTouchKeyboard::applyPreferences(QWidget * window, bool silent) { +void KTouchKeyboard::applyPreferences(TQWidget * window, bool silent) { // let's check whether the keyboard layout has changed if (KTouchConfig().m_currentKeyboardFile!=m_currentLayout) { // if the layout is the number layout just create it and we're done @@ -425,7 +425,7 @@ void KTouchKeyboard::applyPreferences(QWidget * window, bool silent) { m_currentLayout=KTouchConfig().m_currentKeyboardFile; } else { - QString errorMsg; + TQString errorMsg; if (!loadKeyboard(window, KURL::fromPathOrURL( KTouchConfig().m_currentKeyboardFile ), &errorMsg)) { KMessageBox::error( 0, i18n("Error reading the keyboard layout; the default number keypad will " "be created instead. You can choose another keyboard layout in the preferences dialog."), @@ -443,8 +443,8 @@ void KTouchKeyboard::applyPreferences(QWidget * window, bool silent) { } -void KTouchKeyboard::newKey(const QChar& nextChar) { - QPainter painter(this); +void KTouchKeyboard::newKey(const TQChar& nextChar) { + TQPainter painter(this); painter.translate(m_shift, MARGIN); // first clean the markings on all keys for (KTouchKey * key = m_keyList.first(); key; key = m_keyList.next()) { @@ -456,16 +456,16 @@ void KTouchKeyboard::newKey(const QChar& nextChar) { if (Prefs::showAnimation()){ // only do this if we want to show animation. // find the key in the key connector list - QValueList<KTouchKeyConnector>::iterator keyIt = m_connectorList.begin(); + TQValueList<KTouchKeyConnector>::iterator keyIt = m_connectorList.begin(); while (keyIt!=m_connectorList.end() && (*keyIt).m_keyChar!=nextChar) ++keyIt; // if found mark the appropriate keys if (keyIt!=m_connectorList.end()) { - QChar targetChar = (*keyIt).m_targetKeyChar; - QChar fingerChar = (*keyIt).m_fingerKeyChar; - QChar controlChar = (*keyIt).m_controlKeyChar; + TQChar targetChar = (*keyIt).m_targetKeyChar; + TQChar fingerChar = (*keyIt).m_fingerKeyChar; + TQChar controlChar = (*keyIt).m_controlKeyChar; // find the keys in the keylist for (KTouchKey * key = m_keyList.first(); key; key = m_keyList.next()) { - if (key->m_keyChar==QChar(0)) continue; // skip decorative keys + if (key->m_keyChar==TQChar(0)) continue; // skip decorative keys if (key->m_keyChar==targetChar) key->m_isNextKey=true; else if (key->m_keyChar==fingerChar) key->m_isActive=true; else if (key->m_keyChar==controlChar) key->m_isActive=true; @@ -478,8 +478,8 @@ void KTouchKeyboard::newKey(const QChar& nextChar) { } -void KTouchKeyboard::paintEvent(QPaintEvent *) { - QPainter painter(this); +void KTouchKeyboard::paintEvent(TQPaintEvent *) { + TQPainter painter(this); painter.translate(m_shift, MARGIN); // just print all visible keys for (KTouchKey * key = m_keyList.first(); key; key = m_keyList.next()) @@ -487,7 +487,7 @@ void KTouchKeyboard::paintEvent(QPaintEvent *) { } -void KTouchKeyboard::resizeEvent(QResizeEvent *) { +void KTouchKeyboard::resizeEvent(TQResizeEvent *) { double hScale = static_cast<double>(width()-2*MARGIN)/m_keyboardWidth; double vScale = static_cast<double>(height()-2*MARGIN)/m_keyboardHeight; double scale = std::min(hScale, vScale); @@ -554,15 +554,15 @@ void KTouchKeyboard::createDefaultKeyboard() { } -bool KTouchKeyboard::readKeyboard(const QString& fileName, QString& errorMsg) { - QFile infile(fileName); +bool KTouchKeyboard::readKeyboard(const TQString& fileName, TQString& errorMsg) { + TQFile infile(fileName); if ( !infile.open( IO_ReadOnly ) ) { errorMsg = i18n("Could not open file."); return false; } - QTextStream in( &infile ); - in.setEncoding(QTextStream::UnicodeUTF8); - QString line; + TQTextStream in( &infile ); + in.setEncoding(TQTextStream::UnicodeUTF8); + TQString line; m_keyList.clear(); // empty the keyboard m_connectorList.clear(); // clear the connections m_keyboardWidth=0; @@ -576,10 +576,10 @@ bool KTouchKeyboard::readKeyboard(const QString& fileName, QString& errorMsg) { if (line.isNull()) continue; // 'line' should now contain a key specification - QTextStream lineStream(line, IO_ReadOnly); - QString keyType; + TQTextStream lineStream(line, IO_ReadOnly); + TQString keyType; int keyAscII; - QString keyText; + TQString keyText; int x(0), y(0), w(0), h(0); lineStream >> keyType >> keyAscII; if (keyType=="FingerKey") { @@ -621,10 +621,10 @@ bool KTouchKeyboard::readKeyboard(const QString& fileName, QString& errorMsg) { void KTouchKeyboard::updateColours() { // loop over all key connections - for (QValueList<KTouchKeyConnector>::iterator it = m_connectorList.begin(); it!=m_connectorList.end(); ++it) { - QChar fingerChar = (*it).m_fingerKeyChar; - if (fingerChar == QChar(0)) continue; - QChar targetChar = (*it).m_targetKeyChar; + for (TQValueList<KTouchKeyConnector>::iterator it = m_connectorList.begin(); it!=m_connectorList.end(); ++it) { + TQChar fingerChar = (*it).m_fingerKeyChar; + if (fingerChar == TQChar(0)) continue; + TQChar targetChar = (*it).m_targetKeyChar; KTouchKey * self=NULL; KTouchKey * colorSource=NULL; // loop over all keys to find the key pointers diff --git a/ktouch/src/ktouchkeyboard.h b/ktouch/src/ktouchkeyboard.h index 88949537..5334c49b 100644 --- a/ktouch/src/ktouchkeyboard.h +++ b/ktouch/src/ktouchkeyboard.h @@ -17,7 +17,7 @@ #include <config.h> #endif -#include <qvaluevector.h> +#include <tqvaluevector.h> #include "ktouchkeyconnector.h" #include "ktouchkey.h" @@ -33,18 +33,18 @@ class KTouchKeyboard { /// Clears the keyboard (resets all data) void clear(); /// Loads a keyboard layout (old format) from file (returns true if successful). - bool load(QWidget * window, const KURL& url); + bool load(TQWidget * window, const KURL& url); /// Loads a lecture (in XML format) from file (returns true if successful). - bool loadXML(QWidget * window, const KURL& url); + bool loadXML(TQWidget * window, const KURL& url); /// Saves the lecture data to file (returns true if successful). - bool saveXML(QWidget * window, const KURL& url) const; + bool saveXML(TQWidget * window, const KURL& url) const; /// Creates the default number keyboard. void createDefault(); /// Updates the indices in the KTouchKeyConnector objects for faster access. void updateConnections(); - QValueVector<KTouchKey> m_keys; ///< Vector with key definitions. - QValueVector<KTouchKeyConnector> m_connectors; ///< Vector with connectivity data. + TQValueVector<KTouchKey> m_keys; ///< Vector with key definitions. + TQValueVector<KTouchKeyConnector> m_connectors; ///< Vector with connectivity data. QString m_title; ///< Title of the keyboard (to appear in the menu). QString m_comment; ///< Comments about the creator of the keyboard layout. @@ -57,11 +57,11 @@ class KTouchKeyboard { private: /// Loads keyboard data from file - bool read(QTextStream& in); + bool read(TQTextStream& in); /// Loads keyboard data from file into an XML document - bool read(const QDomDocument& doc); + bool read(const TQDomDocument& doc); /// Saves keyboard data in the XML document - void write(QDomDocument& doc) const; + void write(TQDomDocument& doc) const; }; #endif // KTOUCHKEYBOARD_H diff --git a/ktouch/src/ktouchkeyboardeditor.cpp b/ktouch/src/ktouchkeyboardeditor.cpp index c3aa93d2..54f026bb 100644 --- a/ktouch/src/ktouchkeyboardeditor.cpp +++ b/ktouch/src/ktouchkeyboardeditor.cpp @@ -13,8 +13,8 @@ #include "ktouchkeyboardeditor.h" #include "ktouchkeyboardeditor.moc" -#include <qlabel.h> -#include <qfont.h> +#include <tqlabel.h> +#include <tqfont.h> #include <kmessagebox.h> #include <kfiledialog.h> @@ -34,7 +34,7 @@ // ***** Public functions *** // ************************** -KTouchKeyboardEditor::KTouchKeyboardEditor(QWidget* parent, const char* name, bool modal, WFlags fl) +KTouchKeyboardEditor::KTouchKeyboardEditor(TQWidget* parent, const char* name, bool modal, WFlags fl) : KTouchKeyboardEditorDlg(parent,name, modal,fl) { } @@ -43,7 +43,7 @@ KTouchKeyboardEditor::KTouchKeyboardEditor(QWidget* parent, const char* name, bo bool KTouchKeyboardEditor::startEditor(const KURL& url) { // call open request dialog and load a keyboard and start the dialogs event loop if // the user did not cancel the open request dialog - if (openKeyboardFile(url)==QDialog::Accepted) { + if (openKeyboardFile(url)==TQDialog::Accepted) { exec(); return true; } @@ -59,8 +59,8 @@ bool KTouchKeyboardEditor::startEditor(const KURL& url) { void KTouchKeyboardEditor::fontBtnClicked() { //kdDebug() << "Fontbutton clicked" << endl; - QFont f; - if (KFontDialog::getFont(f, false, this, true)==QDialog::Accepted) { + TQFont f; + if (KFontDialog::getFont(f, false, this, true)==TQDialog::Accepted) { m_keyboard.m_fontSuggestions = f.toString(); // update font and keyboard display titleEdit->setFont(f); @@ -89,7 +89,7 @@ void KTouchKeyboardEditor::saveBtnClicked() { // ----------------------------------------------------------------------------- void KTouchKeyboardEditor::saveAsBtnClicked() { - QString tmp = KFileDialog::getSaveFileName(QString::null, + TQString tmp = KFileDialog::getSaveFileName(TQString::null, i18n("*.keyboard.xml|KTouch Keyboard Files (*.keyboard.xml)\n*.*|All Files"), this, i18n("Save Keyboard Layout") ); if (!tmp.isEmpty()) { transfer_from_dialog(); @@ -116,13 +116,13 @@ void KTouchKeyboardEditor::removeBtnClicked() { // ----------------------------------------------------------------------------- /// Called when the selection in the key list box has changed -void KTouchKeyboardEditor::keySelectionChanged(QListBoxItem * item) { +void KTouchKeyboardEditor::keySelectionChanged(TQListBoxItem * item) { } // ----------------------------------------------------------------------------- -void KTouchKeyboardEditor::paintEvent(QPaintEvent *) { +void KTouchKeyboardEditor::paintEvent(TQPaintEvent *) { } // ----------------------------------------------------------------------------- @@ -143,7 +143,7 @@ void KTouchKeyboardEditor::transfer_to_dialog() { languageEdit->setText(m_keyboard.m_language); kdDebug() << "Setting font '"<< m_keyboard.m_fontSuggestions <<"'" << endl; if (!m_keyboard.m_fontSuggestions.isEmpty()) { - QFont f; + TQFont f; f.fromString(m_keyboard.m_fontSuggestions); titleEdit->setFont(f); keyboardCommentEdit->setFont(f); @@ -151,15 +151,15 @@ void KTouchKeyboardEditor::transfer_to_dialog() { } kdDebug() << "Adding key definitions to key list" << endl; keyListBox->clear(); - QValueVector<KTouchKey>::iterator it; + TQValueVector<KTouchKey>::iterator it; unsigned int min_x = 100000; unsigned int max_x = 0; unsigned int min_y = 100000; unsigned int max_y = 0; for( it = m_keyboard.m_keys.begin(); it != m_keyboard.m_keys.end(); ++it ) { switch (it->m_type) { - case KTouchKey::NORMAL : keyListBox->insertItem("N '" + QString(it->m_primaryChar) + "'"); break; - case KTouchKey::FINGER : keyListBox->insertItem("F '" + QString(it->m_primaryChar) + "'"); break; + case KTouchKey::NORMAL : keyListBox->insertItem("N '" + TQString(it->m_primaryChar) + "'"); break; + case KTouchKey::FINGER : keyListBox->insertItem("F '" + TQString(it->m_primaryChar) + "'"); break; default : keyListBox->insertItem("O '" + it->m_otherKeyText + "'"); break; } min_x = std::min<unsigned int>(min_x, it->m_x); @@ -193,7 +193,7 @@ int KTouchKeyboardEditor::openKeyboardFile(const KURL& url) { i18n("Create new keyboard!"), url, KTouchPtr->lectureFiles(), i18n("<no keyboard files available>")); - if (result == QDialog::Accepted) { + if (result == TQDialog::Accepted) { // Ok, user confirmed the dialog, now lets get the url m_currentURL = new_url; // Try to load the keyboard, if that fails, we create a new keyboard instead @@ -201,7 +201,7 @@ int KTouchKeyboardEditor::openKeyboardFile(const KURL& url) { !m_keyboard.load(this, m_currentURL) && !m_keyboard.loadXML(this, m_currentURL)) { KMessageBox::sorry(this, i18n("Could not open the keyboard file, creating a new one instead!")); - m_currentURL = QString::null; // new keyboards haven't got a URL + m_currentURL = TQString::null; // new keyboards haven't got a URL m_keyboard.clear(); } // If we have no URL, we create a new keyboard - can happen if either the user @@ -213,9 +213,9 @@ int KTouchKeyboardEditor::openKeyboardFile(const KURL& url) { else setModified(false); // newly read keyboards are not modified in the begin transfer_to_dialog(); // Update our editor with the keyboard data - return QDialog::Accepted; + return TQDialog::Accepted; } - else return QDialog::Rejected; + else return TQDialog::Rejected; } // ----------------------------------------------------------------------------- @@ -234,7 +234,7 @@ bool KTouchKeyboardEditor::saveModified() { if (!m_modified) return true; // ok, ask the user to save the changes int result = KMessageBox::questionYesNoCancel(this, - i18n("The keyboard has been changed. Do you want to save the changes?"),QString::null,KStdGuiItem::save(),KStdGuiItem::discard()); + i18n("The keyboard has been changed. Do you want to save the changes?"),TQString::null,KStdGuiItem::save(),KStdGuiItem::discard()); if (result == KMessageBox::Cancel) return false; // User aborted if (result == KMessageBox::Yes) saveBtnClicked(); // if successfully saved the modified flag will be resetted in the saveBtnClicked() function diff --git a/ktouch/src/ktouchkeyboardeditor.h b/ktouch/src/ktouchkeyboardeditor.h index 2c42a3a9..48c6e4f6 100644 --- a/ktouch/src/ktouchkeyboardeditor.h +++ b/ktouch/src/ktouchkeyboardeditor.h @@ -44,7 +44,7 @@ class KTouchKeyboardEditor : public KTouchKeyboardEditorDlg { public: /// Constructor. - KTouchKeyboardEditor(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + KTouchKeyboardEditor(TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); /// Default destructor. ~KTouchKeyboardEditor() {} /// Shows and executes the dialog (argument is the url to the default or @@ -72,7 +72,7 @@ class KTouchKeyboardEditor : public KTouchKeyboardEditorDlg { /// Called when the "Remove" button was clicked virtual void removeBtnClicked(); /// Called when the selection in the key list box has changed - virtual void keySelectionChanged(QListBoxItem * item); + virtual void keySelectionChanged(TQListBoxItem * item); /// Will be called whenever some changes are made. void setModified() { setModified(true); } @@ -83,7 +83,7 @@ class KTouchKeyboardEditor : public KTouchKeyboardEditorDlg { protected: /// Draws the keyboard in the keyboardPreviewLabel. - void paintEvent(QPaintEvent *); + void paintEvent(TQPaintEvent *); private: /// Transfers data from the keyboard object to the dialog. diff --git a/ktouch/src/ktouchkeyboardwidget.cpp b/ktouch/src/ktouchkeyboardwidget.cpp index 6e92c99d..99cc63cc 100644 --- a/ktouch/src/ktouchkeyboardwidget.cpp +++ b/ktouch/src/ktouchkeyboardwidget.cpp @@ -16,7 +16,7 @@ #include <algorithm> #include <set> -#include <qfile.h> +#include <tqfile.h> #include <kdebug.h> #include <ktempfile.h> @@ -31,12 +31,12 @@ // the margin between keyboard and widget frame const int MARGIN = 10; -QMap<QChar, int> KTouchKeyboardWidget::m_keyCharMap; +TQMap<TQChar, int> KTouchKeyboardWidget::m_keyCharMap; // -------------------------------------------------------------------------- -KTouchKeyboardWidget::KTouchKeyboardWidget(QWidget *parent) - : QWidget(parent), m_keyboardWidth(100), m_keyboardHeight(60), m_currentLayout(""), +KTouchKeyboardWidget::KTouchKeyboardWidget(TQWidget *parent) + : TQWidget(parent), m_keyboardWidth(100), m_keyboardHeight(60), m_currentLayout(""), m_hideKeyboard(false) { setMinimumHeight(100); // when it's smaller you won't see anything @@ -44,10 +44,10 @@ KTouchKeyboardWidget::KTouchKeyboardWidget(QWidget *parent) } -bool KTouchKeyboardWidget::loadKeyboard(QWidget * window, const KURL& url, QString* errorMsg) { - QString target; +bool KTouchKeyboardWidget::loadKeyboard(TQWidget * window, const KURL& url, TQString* errorMsg) { + TQString target; if (KIO::NetAccess::download(url, target, window)) { - QString msg; + TQString msg; bool result = readKeyboard(target, msg); KIO::NetAccess::removeTempFile(target); if (!result && errorMsg!=NULL) @@ -62,8 +62,8 @@ bool KTouchKeyboardWidget::loadKeyboard(QWidget * window, const KURL& url, QStri } -void KTouchKeyboardWidget::saveKeyboard(QWidget * window, const KURL& url) { - QString tmpFile; +void KTouchKeyboardWidget::saveKeyboard(TQWidget * window, const KURL& url) { + TQString tmpFile; KTempFile *temp=0; if (url.isLocalFile()) tmpFile=url.path(); // for local files the path is sufficient @@ -72,13 +72,13 @@ void KTouchKeyboardWidget::saveKeyboard(QWidget * window, const KURL& url) { tmpFile=temp->name(); } - QFile outfile(tmpFile); + TQFile outfile(tmpFile); if ( !outfile.open( IO_WriteOnly ) ) { if (temp) delete temp; return; } - QTextStream out( &outfile ); + TQTextStream out( &outfile ); out << "########################################## \n"; out << "# # \n"; out << "# Keyboard layout file for KTouch # \n"; @@ -94,7 +94,7 @@ void KTouchKeyboardWidget::saveKeyboard(QWidget * window, const KURL& url) { case KTouchBaseKey::CONTROL_KEY : out << "ControlKey "; break; default : out << "NormalKey "; break; } - QRect rect=key->frame(); + TQRect rect=key->frame(); out << key->m_keyChar.unicode() << '\t' << key->m_keyText << '\t' << rect.left() << '\t' << rect.top() << '\t' << rect.width() << '\t' << rect.height() << endl; } @@ -106,7 +106,7 @@ void KTouchKeyboardWidget::saveKeyboard(QWidget * window, const KURL& url) { } } -void KTouchKeyboardWidget::applyPreferences(QWidget * window, bool silent) { +void KTouchKeyboardWidget::applyPreferences(TQWidget * window, bool silent) { m_hideKeyboard = Prefs::hideKeyboard(); if (m_hideKeyboard) setMaximumHeight(100); @@ -130,7 +130,7 @@ void KTouchKeyboardWidget::applyPreferences(QWidget * window, bool silent) { m_currentLayout=Prefs::currentKeyboardFile(); } else { - QString errorMsg; + TQString errorMsg; if (!loadKeyboard(window, KURL::fromPathOrURL( Prefs::currentKeyboardFile() ), &errorMsg)) { KMessageBox::error( 0, i18n("Error reading the keyboard layout; the default number keypad will " "be created instead. You can choose another keyboard layout in the preferences dialog."), @@ -155,9 +155,9 @@ void KTouchKeyboardWidget::applyPreferences(QWidget * window, bool silent) { } -void KTouchKeyboardWidget::newKey(const QChar& nextChar) { +void KTouchKeyboardWidget::newKey(const TQChar& nextChar) { if (m_hideKeyboard) return; - QPainter painter(this); + TQPainter painter(this); painter.translate(m_shift, MARGIN); // first clean the markings on all keys for (KTouchBaseKey * key = m_keyList.first(); key; key = m_keyList.next()) { @@ -169,16 +169,16 @@ void KTouchKeyboardWidget::newKey(const QChar& nextChar) { if (Prefs::showAnimation()){ // only do this if we want to show animation. // find the key in the key connector list - QValueList<KTouchKeyConnection>::iterator keyIt = m_connectorList.begin(); + TQValueList<KTouchKeyConnection>::iterator keyIt = m_connectorList.begin(); while (keyIt!=m_connectorList.end() && (*keyIt).m_keyChar!=nextChar) ++keyIt; // if found mark the appropriate keys if (keyIt!=m_connectorList.end()) { - QChar targetChar = (*keyIt).m_targetKeyChar; - QChar fingerChar = (*keyIt).m_fingerKeyChar; - QChar controlChar = (*keyIt).m_controlKeyChar; + TQChar targetChar = (*keyIt).m_targetKeyChar; + TQChar fingerChar = (*keyIt).m_fingerKeyChar; + TQChar controlChar = (*keyIt).m_controlKeyChar; // find the keys in the keylist for (KTouchBaseKey * key = m_keyList.first(); key; key = m_keyList.next()) { - if (key->m_keyChar==QChar(0)) continue; // skip decorative keys + if (key->m_keyChar==TQChar(0)) continue; // skip decorative keys if (key->m_keyChar==targetChar) key->m_isNextKey=true; else if (key->m_keyChar==fingerChar) key->m_isActive=true; else if (key->m_keyChar==controlChar) key->m_isActive=true; @@ -191,9 +191,9 @@ void KTouchKeyboardWidget::newKey(const QChar& nextChar) { } -void KTouchKeyboardWidget::paintEvent(QPaintEvent *) { +void KTouchKeyboardWidget::paintEvent(TQPaintEvent *) { if (m_hideKeyboard) return; - QPainter p(this); + TQPainter p(this); p.translate(m_shift, MARGIN); // just print all visible keys for (KTouchBaseKey * key = m_keyList.first(); key; key = m_keyList.next()) @@ -202,9 +202,9 @@ void KTouchKeyboardWidget::paintEvent(QPaintEvent *) { /* // TODO : later const KTouchColorScheme& colorScheme = KTouchColorScheme::m_colorSchemes[Prefs::colorScheme()]; - for (QValueVector<KTouchKey>::iterator it = m_keys.begin(); it != m_keys.end(); ++it) { + for (TQValueVector<KTouchKey>::iterator it = m_keys.begin(); it != m_keys.end(); ++it) { // determine colors - QColor textColor; + TQColor textColor; if (it->m_type == KTouchKey::NORMAL || it->m_type == KTouchKey::FINGER) { if (is_next_key) { // mark the key as "next" @@ -229,14 +229,14 @@ void KTouchKeyboardWidget::paintEvent(QPaintEvent *) { p.setFont( m_font ); p.drawText(it->m_xS, it->m_yS, it->m_wS, it->m_hS, - QPainter::AlignCenter, m_keyText); + TQPainter::AlignCenter, m_keyText); } */ // TODO : later copy pre-rendered and pre-scaled characters to screen } -void KTouchKeyboardWidget::resizeEvent(QResizeEvent *) { +void KTouchKeyboardWidget::resizeEvent(TQResizeEvent *) { // kdDebug() << "[KTouchKeyboard::resizeEvent] Window = " << width() << "x" << height() << endl; // kdDebug() << "[KTouchKeyboard::resizeEvent] Keyboard = " << m_keyboardWidth << "x" << m_keyboardHeight << endl; double hScale = static_cast<double>(width()-2*MARGIN)/m_keyboardWidth; @@ -246,7 +246,7 @@ void KTouchKeyboardWidget::resizeEvent(QResizeEvent *) { m_shift = (width() - static_cast<int>(m_keyboardWidth*scale))/2; for (KTouchBaseKey * key = m_keyList.first(); key; key = m_keyList.next()) key->resize(scale); // resize all keys - for (QValueVector<KTouchKey>::iterator it = m_keys.begin(); it != m_keys.end(); ++it) { + for (TQValueVector<KTouchKey>::iterator it = m_keys.begin(); it != m_keys.end(); ++it) { it->resize(scale); // resize all keys } update(); // and finally redraw the keyboard @@ -318,7 +318,7 @@ void KTouchKeyboardWidget::createDefaultKeyboard() { row = h+sp; m_keys.clear(); - m_keys.append( KTouchKey( 0, 0, w, h, QString("Num")) ); // 0 + m_keys.append( KTouchKey( 0, 0, w, h, TQString("Num")) ); // 0 m_keys.append( KTouchKey(KTouchKey::NORMAL, col, 0, w, h, '/') ); // 1 m_keys.append( KTouchKey(KTouchKey::NORMAL, 2*col, 0, w, h, '*') ); // 2 m_keys.append( KTouchKey(KTouchKey::NORMAL, 3*col, 0, w, h, '-') ); // 3 @@ -357,25 +357,25 @@ void KTouchKeyboardWidget::createDefaultKeyboard() { m_keyConnections.append( KTouchKeyConnector('3', 13, 9, 0) ); m_keyConnections.append( KTouchKeyConnector('0', 14, 7, 0) ); m_keyConnections.append( KTouchKeyConnector('.', 15, 9, 0) ); - m_keyConnections.append( KTouchKeyConnector(QChar(13), 16, 10, 0) ); - m_keyConnections.append( KTouchKeyConnector(QChar(8), 17, 0, 0) ); + m_keyConnections.append( KTouchKeyConnector(TQChar(13), 16, 10, 0) ); + m_keyConnections.append( KTouchKeyConnector(TQChar(8), 17, 0, 0) ); } -bool KTouchKeyboardWidget::readKeyboard(const QString& fileName, QString& errorMsg) { - QFile infile(fileName); +bool KTouchKeyboardWidget::readKeyboard(const TQString& fileName, TQString& errorMsg) { + TQFile infile(fileName); if ( !infile.open( IO_ReadOnly ) ) { errorMsg = i18n("Could not open file."); return false; } - QTextStream in( &infile ); - in.setEncoding(QTextStream::UnicodeUTF8); - QString line; + TQTextStream in( &infile ); + in.setEncoding(TQTextStream::UnicodeUTF8); + TQString line; m_keyList.clear(); // empty the keyboard m_connectorList.clear(); // clear the connections m_keyboardWidth=0; m_keyboardHeight=0; - std::set<QChar> keys; + std::set<TQChar> keys; // now loop until end of file is reached do { // skip all empty lines or lines containing a comment (starting with '#') @@ -385,10 +385,10 @@ bool KTouchKeyboardWidget::readKeyboard(const QString& fileName, QString& errorM if (line.isNull()) continue; // 'line' should now contain a key specification - QTextStream lineStream(line, IO_ReadOnly); - QString keyType; + TQTextStream lineStream(line, IO_ReadOnly); + TQString keyType; int keyAscII; - QString keyText; + TQString keyText; int x(0), y(0), w(0), h(0); lineStream >> keyType >> keyAscII; if (keyType=="FingerKey") { @@ -397,7 +397,7 @@ bool KTouchKeyboardWidget::readKeyboard(const QString& fileName, QString& errorM w=h=8; // default values for old keyboard files m_keyList.append( new KTouchFingerKey(keyAscII, keyText, x+1, y+1, w, h) ); m_connectorList.append( KTouchKeyConnection(keyAscII, keyAscII, 0, 0) ); -// kdDebug() << "read : F : unicode = " << keyAscII << " char = " << QChar(keyAscII) << endl; +// kdDebug() << "read : F : unicode = " << keyAscII << " char = " << TQChar(keyAscII) << endl; } else if (keyType=="ControlKey") { lineStream >> keyText >> x >> y >> w >> h; @@ -412,12 +412,12 @@ bool KTouchKeyboardWidget::readKeyboard(const QString& fileName, QString& errorM // retrieve the finger key with the matching char m_keyList.append( new KTouchNormalKey(keyAscII, keyText, x+1, y+1, w, h) ); m_connectorList.append( KTouchKeyConnection(keyAscII, keyAscII, fingerCharCode, 0) ); -// kdDebug() << "read : N : unicode = " << keyAscII << " char = " << QChar(keyAscII) << endl; +// kdDebug() << "read : N : unicode = " << keyAscII << " char = " << TQChar(keyAscII) << endl; } else if (keyType=="HiddenKey") { int targetChar, fingerChar, controlChar; lineStream >> targetChar >> fingerChar >> controlChar; m_connectorList.append( KTouchKeyConnection(keyAscII, targetChar, fingerChar, controlChar) ); -// kdDebug() << "read : H : unicode = " << keyAscII << " char = " << QChar(keyAscII) << " target = " << targetChar << " finger = " << fingerChar << " control = " << controlChar << endl; +// kdDebug() << "read : H : unicode = " << keyAscII << " char = " << TQChar(keyAscII) << " target = " << targetChar << " finger = " << fingerChar << " control = " << controlChar << endl; } else { @@ -438,7 +438,7 @@ bool KTouchKeyboardWidget::readKeyboard(const QString& fileName, QString& errorM m_keyboardHeight = std::max(m_keyboardHeight, y+h); } while (!in.atEnd() && !line.isNull()); // kdDebug() << "showing all unicode numbers in this file" << endl; -/* for (std::set<QChar>::iterator it = keys.begin(); it != keys.end(); ++it) +/* for (std::set<TQChar>::iterator it = keys.begin(); it != keys.end(); ++it) kdDebug() << *it << endl; */ // kdDebug() << "num chars = " << keys.size() << endl; @@ -454,11 +454,11 @@ void KTouchKeyboardWidget::updateColours() { // old functionality : loop over all key connections m_keyCharMap.clear(); unsigned int counter = 0; - for (QValueList<KTouchKeyConnection>::iterator it = m_connectorList.begin(); it!=m_connectorList.end(); ++it) { + for (TQValueList<KTouchKeyConnection>::iterator it = m_connectorList.begin(); it!=m_connectorList.end(); ++it) { // store finger and target characters - QChar fingerChar = (*it).m_fingerKeyChar; - QChar targetChar = (*it).m_targetKeyChar; // this is the _base_ character of the key that needs to be highlighted - QChar ch = (*it).m_keyChar; + TQChar fingerChar = (*it).m_fingerKeyChar; + TQChar targetChar = (*it).m_targetKeyChar; // this is the _base_ character of the key that needs to be highlighted + TQChar ch = (*it).m_keyChar; /* kdDebug() << "Key #"<<++counter<<": " << ch << "(" << ch.unicode() << ") " << "target = " << targetChar << "(" << targetChar.unicode() << ") " @@ -466,7 +466,7 @@ void KTouchKeyboardWidget::updateColours() { */ m_keyCharMap[ch] = -1; - if (fingerChar == QChar(0)) { + if (fingerChar == TQChar(0)) { // kdDebug() << "skipped char = " << targetChar << endl; continue; // skips keys that don't have finger keys assigned } @@ -514,7 +514,7 @@ void KTouchKeyboardWidget::updateColours() { for (unsigned int i=0; i<m_keys.size(); ++i) m_keyMap[i] = -1; int c_index = 0; - for (QValueVector<KTouchKeyConnector>::iterator it = m_keyConnections.begin(); + for (TQValueVector<KTouchKeyConnector>::iterator it = m_keyConnections.begin(); it!=m_keyConnections.end(); ++it) { if (it->m_targetKeyIndex == -1) continue; diff --git a/ktouch/src/ktouchkeyboardwidget.h b/ktouch/src/ktouchkeyboardwidget.h index 9ba71d8f..047a7575 100644 --- a/ktouch/src/ktouchkeyboardwidget.h +++ b/ktouch/src/ktouchkeyboardwidget.h @@ -17,9 +17,9 @@ #include <config.h> #endif -#include <qwidget.h> -#include <qvaluevector.h> -#include <qmap.h> +#include <tqwidget.h> +#include <tqvaluevector.h> +#include <tqmap.h> #include "ktouchkeys.h" #include "ktouchkey.h" // new class @@ -39,58 +39,58 @@ class KURL; * and the newKey() slot is called the state changes (and thus the * activated keys and finger key animations etc.) */ -class KTouchKeyboardWidget : public QWidget { +class KTouchKeyboardWidget : public TQWidget { Q_OBJECT public: /// Constructor - KTouchKeyboardWidget(QWidget *parent); + KTouchKeyboardWidget(TQWidget *parent); /// Reads a keyboard layout from the given URL. /// The function returns 'true' when the reading was successful or 'false' if not. In this /// case the optional parameter errorMsg contains the error message. - bool loadKeyboard(QWidget * window, const KURL& url, QString* errorMsg=NULL); + bool loadKeyboard(TQWidget * window, const KURL& url, TQString* errorMsg=NULL); /// Saves the keyboard layout to the URL. - void saveKeyboard(QWidget * window, const KURL& url); + void saveKeyboard(TQWidget * window, const KURL& url); /// Applies preferences to the keyboard layout and the keys. /// This means that the layout is basically recreated and if the layout type/language /// changed it will be reloaded. - void applyPreferences(QWidget * window, bool silent); + void applyPreferences(TQWidget * window, bool silent); public slots: /// This function displays the next key (or key combination) the user has to press. - void newKey(const QChar& nextChar); + void newKey(const TQChar& nextChar); protected: /// Draws the keyboard. - void paintEvent(QPaintEvent *); + void paintEvent(TQPaintEvent *); /// Resizes (recalculates m_shift and m_scale) and redraws the keyboard. - void resizeEvent(QResizeEvent *); + void resizeEvent(TQResizeEvent *); private: /// Does what the name says (create a default keyboard which is a number keypad). /// This function is needed in case there no keyboard file could be found. void createDefaultKeyboard(); /// Does the actual reading. - bool readKeyboard(const QString& fileName, QString& errorMsg); + bool readKeyboard(const TQString& fileName, TQString& errorMsg); /// Assigns the background colours to the normal keys, which have a finger key assigned. void updateColours(); // *** new data storage classes *** - QValueVector<KTouchKey> m_keys; ///< The geometrical key data. - QValueVector<KTouchKeyConnector> m_keyConnections; ///< Contains the character - key associations. - QMap<unsigned int, int> m_keyMap; ///< Links target keys with finger keys: m_keyMap[target_key] = finger_key - QMap<unsigned int, unsigned int> m_colorMap; ///< Links finger keys with color indices: m_colorMap[finger_key] = color_index in color scheme + TQValueVector<KTouchKey> m_keys; ///< The geometrical key data. + TQValueVector<KTouchKeyConnector> m_keyConnections; ///< Contains the character - key associations. + TQMap<unsigned int, int> m_keyMap; ///< Links target keys with finger keys: m_keyMap[target_key] = finger_key + TQMap<unsigned int, unsigned int> m_colorMap; ///< Links finger keys with color indices: m_colorMap[finger_key] = color_index in color scheme // *** old data storage classes *** - QPtrList<KTouchBaseKey> m_keyList; ///< The pointer list with base class pointers to the keys. - QValueList<KTouchKeyConnection> m_connectorList; ///< Contains the character - key associations. + TQPtrList<KTouchBaseKey> m_keyList; ///< The pointer list with base class pointers to the keys. + TQValueList<KTouchKeyConnection> m_connectorList; ///< Contains the character - key associations. - static QMap<QChar, int> m_keyCharMap; ///< Links target keys with finger keys: m_keyCharMap[target_key_char] = color_index + static TQMap<TQChar, int> m_keyCharMap; ///< Links target keys with finger keys: m_keyCharMap[target_key_char] = color_index int m_keyboardWidth; ///< The width of the keyboard (maximum of the sums of all keywidths in each line). int m_keyboardHeight; ///< The height of the keyboard (sum of all key row heights). double m_shift; ///< The horizontal shift for the keyboard. - QString m_currentLayout; ///< The name of the currently used layout. - QChar m_nextKey; ///< The next to be pressed character. + TQString m_currentLayout; ///< The name of the currently used layout. + TQChar m_nextKey; ///< The next to be pressed character. bool m_hideKeyboard; ///< If true, the keyboard won't be shown. }; diff --git a/ktouch/src/ktouchkeyconnector.cpp b/ktouch/src/ktouchkeyconnector.cpp index 2546400f..6a51764f 100644 --- a/ktouch/src/ktouchkeyconnector.cpp +++ b/ktouch/src/ktouchkeyconnector.cpp @@ -13,14 +13,14 @@ #include "ktouchkeyconnector.h" // Reads the key connector data from the DomElement -bool KTouchKeyConnector::read(QDomNode node) { -/* QDomNode newChars = in.namedItem("NewCharacters"); +bool KTouchKeyConnector::read(TQDomNode node) { +/* TQDomNode newChars = in.namedItem("NewCharacters"); if (newChars.isNull()) m_newChars = i18n("basically all characters on the keyboard","abcdefghijklmnopqrstuvwxyz"); else m_newChars = newChars.firstChild().nodeValue(); - QDomNode levelComment = in.namedItem("LevelComment"); + TQDomNode levelComment = in.namedItem("LevelComment"); if (!levelComment.isNull()) m_comment = levelComment.firstChild().nodeValue(); m_lines.clear(); - QDomNode line = in.namedItem("Line"); + TQDomNode line = in.namedItem("Line"); while ( !line.isNull() ) { m_lines.push_back( line.firstChild().nodeValue() ); line = line.nextSibling(); @@ -34,13 +34,13 @@ bool KTouchKeyConnector::read(QDomNode node) { } // Creates a new DomElement, writes the key connector data into it and appends it to the root object. -void KTouchKeyConnector::write(QDomDocument& doc, QDomElement& root) const { -/* QDomElement element = doc.createElement("KeyConnector"); - QDomText textnode = doc.createTextNode(QString(m_keyChar)); +void KTouchKeyConnector::write(TQDomDocument& doc, TQDomElement& root) const { +/* TQDomElement element = doc.createElement("KeyConnector"); + TQDomText textnode = doc.createTextNode(TQString(m_keyChar)); element.appendChild(textnode); - element.setAttribute("TargetKeyChar", QString(m_targetKeyChar)); - if (m_fingerKeyChar != QChar(0)) - element.setAttribute("FingerKeyChar", QString(m_fingerKeyChar)); + element.setAttribute("TargetKeyChar", TQString(m_targetKeyChar)); + if (m_fingerKeyChar != TQChar(0)) + element.setAttribute("FingerKeyChar", TQString(m_fingerKeyChar)); if (!m_controlKeyId.isEmpty()) element.setAttribute("ControlKeyId", m_controlKeyId); root.appendChild(element); diff --git a/ktouch/src/ktouchkeyconnector.h b/ktouch/src/ktouchkeyconnector.h index a8d20dea..12793465 100644 --- a/ktouch/src/ktouchkeyconnector.h +++ b/ktouch/src/ktouchkeyconnector.h @@ -17,8 +17,8 @@ #include <config.h> #endif -#include <qdom.h> -#include <qvaluevector.h> +#include <tqdom.h> +#include <tqvaluevector.h> #include "ktouchkey.h" /// The KTouchKeyConnector class contains the information about the character that has to @@ -28,18 +28,18 @@ class KTouchKeyConnector { public: KTouchKeyConnector() {} /// Constructor - KTouchKeyConnector(QChar keyChar, unsigned int target_key, unsigned int finger_key, + KTouchKeyConnector(TQChar keyChar, unsigned int target_key, unsigned int finger_key, unsigned int modifier_key) : m_keyChar(keyChar), m_targetKeyIndex(target_key), m_fingerKeyIndex(finger_key), m_modifierKeyIndex(modifier_key) {} /// Reads the key connector data from the DomElement - bool read(QDomNode node); + bool read(TQDomNode node); /// Creates a new DomElement, writes the key connector data into it and appends it to the root object. - void write(QDomDocument& doc, QDomElement& root) const; + void write(TQDomDocument& doc, TQDomElement& root) const; - QChar m_keyChar; ///< This is the character that has to be pressed to access this key. + TQChar m_keyChar; ///< This is the character that has to be pressed to access this key. int m_targetKeyIndex; ///< Index of the target key (-1 if none). int m_fingerKeyIndex; ///< Index of the finger key (-1 if none). int m_modifierKeyIndex; ///< Index of the modifier key (-1 if none). diff --git a/ktouch/src/ktouchkeys.cpp b/ktouch/src/ktouchkeys.cpp index c254682b..83efa572 100644 --- a/ktouch/src/ktouchkeys.cpp +++ b/ktouch/src/ktouchkeys.cpp @@ -25,7 +25,7 @@ int KTouchFingerKey::m_fingerKeyCount = 0; // ***** Implementation of class KTouchKey **** -void KTouchBaseKey::paint(QPainter& p) const { +void KTouchBaseKey::paint(TQPainter& p) const { // We simply paint the key using the current brush and pen, so the derived classes // will have to care about that p.fillRect(m_xS, m_yS, m_wS, m_hS, p.brush()); @@ -47,16 +47,16 @@ void KTouchBaseKey::resize(double scale) { // **** Implementation of class KTouchNormalKey **** -KTouchNormalKey::KTouchNormalKey(const QChar& keyChar, const QString& keyText, int x, int y, int w, int h) +KTouchNormalKey::KTouchNormalKey(const TQChar& keyChar, const TQString& keyText, int x, int y, int w, int h) : KTouchBaseKey(keyChar, keyText, x, y, w, h), m_colorIndex(0) { m_type = NORMAL_KEY; m_font_scale =2; } -void KTouchNormalKey::paint(QPainter& p) const { +void KTouchNormalKey::paint(TQPainter& p) const { const KTouchColorScheme& colorScheme = KTouchColorScheme::m_colorSchemes[Prefs::currentColorScheme()]; - QColor textColor; + TQColor textColor; if (m_isNextKey) { // mark the key as "next" p.setBrush( colorScheme.m_backgroundH ); @@ -72,7 +72,7 @@ void KTouchNormalKey::paint(QPainter& p) const { p.setPen(textColor); p.setFont( m_font ); - p.drawText(m_xS, m_yS, m_wS, m_hS, QPainter::AlignCenter, m_keyText); + p.drawText(m_xS, m_yS, m_wS, m_hS, TQPainter::AlignCenter, m_keyText); } // -------------------------------------------------------------- @@ -80,7 +80,7 @@ void KTouchNormalKey::paint(QPainter& p) const { // **** Implementation of class KTouchFingerKey **** -KTouchFingerKey::KTouchFingerKey(const QChar& keyChar, const QString& keyText, int x, int y, int w, int h) +KTouchFingerKey::KTouchFingerKey(const TQChar& keyChar, const TQString& keyText, int x, int y, int w, int h) : KTouchNormalKey(keyChar, keyText, x, y, w, h) { m_colorIndex = m_fingerKeyCount++; @@ -93,24 +93,24 @@ KTouchFingerKey::KTouchFingerKey(const QChar& keyChar, const QString& keyText, i m_font_scale =2; } -void KTouchFingerKey::paint(QPainter& p) const { +void KTouchFingerKey::paint(TQPainter& p) const { const KTouchColorScheme& colorScheme = KTouchColorScheme::m_colorSchemes[Prefs::currentColorScheme()]; p.setFont( m_font ); if (m_isActive) { p.setBrush( colorScheme.m_background[m_colorIndex] ); p.setPen( colorScheme.m_frame ); KTouchBaseKey::paint(p); // draw background and frame - p.setPen( QPen(colorScheme.m_frame,3) ); + p.setPen( TQPen(colorScheme.m_frame,3) ); p.drawRect(m_xS+2, m_yS+2, m_wS-4, m_hS-4); // mark it as "active" p.setPen( colorScheme.m_text ); - p.drawText(m_xS, m_yS, m_wS, m_hS, QPainter::AlignCenter, m_keyText); + p.drawText(m_xS, m_yS, m_wS, m_hS, TQPainter::AlignCenter, m_keyText); } else if (m_isNextKey) { p.setBrush( colorScheme.m_backgroundH ); p.setPen( colorScheme.m_frame ); KTouchBaseKey::paint(p); p.setPen( colorScheme.m_textH ); - p.drawText(m_xS, m_yS, m_wS, m_hS, QPainter::AlignCenter, m_keyText); + p.drawText(m_xS, m_yS, m_wS, m_hS, TQPainter::AlignCenter, m_keyText); } else { p.setBrush( colorScheme.m_background[m_colorIndex] ); @@ -118,7 +118,7 @@ void KTouchFingerKey::paint(QPainter& p) const { KTouchBaseKey::paint(p); p.drawRoundRect(m_xS+2, m_yS+2, m_wS-4, m_hS-4); p.setPen( colorScheme.m_text ); - p.drawText(m_xS, m_yS, m_wS, m_hS, QPainter::AlignCenter, m_keyText); + p.drawText(m_xS, m_yS, m_wS, m_hS, TQPainter::AlignCenter, m_keyText); }; } // -------------------------------------------------------------- @@ -127,17 +127,17 @@ void KTouchFingerKey::paint(QPainter& p) const { // **** Implementation of class KTouchControlKey **** -KTouchControlKey::KTouchControlKey(const QChar& keyChar, const QString& keyText, int x, int y, int w, int h) +KTouchControlKey::KTouchControlKey(const TQChar& keyChar, const TQString& keyText, int x, int y, int w, int h) : KTouchBaseKey(keyChar, keyText, x, y, w, h) { m_type = CONTROL_KEY; m_font_scale = 4; } -void KTouchControlKey::paint(QPainter& p) const { +void KTouchControlKey::paint(TQPainter& p) const { const KTouchColorScheme& colorScheme = KTouchColorScheme::m_colorSchemes[Prefs::currentColorScheme()]; p.setFont( m_font ); - QColor textColor; + TQColor textColor; if (m_isActive) { p.setBrush( colorScheme.m_cBackgroundH ); p.setPen( colorScheme.m_frame ); @@ -213,10 +213,10 @@ void KTouchControlKey::paint(QPainter& p) const { p.drawLine(xleft, y, xleft+ch/3, y+static_cast<int>(ch*0.15)); } else if (m_keyText=="AltGr") { - p.drawText(m_xS, m_yS, m_wS, m_hS, QPainter::AlignCenter | QPainter::AlignVCenter, "Alt Gr"); + p.drawText(m_xS, m_yS, m_wS, m_hS, TQPainter::AlignCenter | TQPainter::AlignVCenter, "Alt Gr"); } else - p.drawText(m_xS, m_yS, m_wS, m_hS, QPainter::AlignCenter | QPainter::AlignVCenter, m_keyText); + p.drawText(m_xS, m_yS, m_wS, m_hS, TQPainter::AlignCenter | TQPainter::AlignVCenter, m_keyText); } diff --git a/ktouch/src/ktouchkeys.h b/ktouch/src/ktouchkeys.h index 90d4222d..68ffa959 100644 --- a/ktouch/src/ktouchkeys.h +++ b/ktouch/src/ktouchkeys.h @@ -17,7 +17,7 @@ #include <config.h> #endif -#include <qpainter.h> +#include <tqpainter.h> class KTouchFingerKey; class KTouchNormalKey; @@ -34,25 +34,25 @@ class KTouchBaseKey { enum KeyType { FINGER_KEY, NORMAL_KEY, CONTROL_KEY }; /// Constructor - KTouchBaseKey(const QChar& keyChar, const QString& keyText, int x, int y, int w, int h) + KTouchBaseKey(const TQChar& keyChar, const TQString& keyText, int x, int y, int w, int h) : m_keyChar(keyChar), m_keyText(keyText), m_isActive(false), m_isNextKey(false), m_x(x), m_y(y), m_w(w), m_h(h), m_type(NORMAL_KEY) {} /// Destructor. virtual ~KTouchBaseKey() {} /// Paints the basic key shape using the painter p. - virtual void paint(QPainter& p) const; + virtual void paint(TQPainter& p) const; /// Recalculates the scaled position and size properties of the key. void resize(double scale); /// Returns the boundary frame of the key. - QRect frame() const { return QRect(m_x, m_y, m_w, m_h); } + TQRect frame() const { return TQRect(m_x, m_y, m_w, m_h); } /// Returns the key type. KeyType type() const { return m_type; } - QChar m_keyChar; ///< The character that needs to be pressed to access this char. - QString m_keyText; ///< The text on the key (may be a single char only). + TQChar m_keyChar; ///< The character that needs to be pressed to access this char. + TQString m_keyText; ///< The text on the key (may be a single char only). bool m_isActive; ///< Indicates whether the key is active (finger and control keys). bool m_isNextKey; ///< Indicates whether this is the next to be pressed key (normal and finger keys). - QFont m_font; + TQFont m_font; float m_font_scale; protected: @@ -79,11 +79,11 @@ class KTouchBaseKey { class KTouchNormalKey : public KTouchBaseKey { public: /// Constructor - KTouchNormalKey(const QChar& keyChar, const QString& keyText, int x, int y, int w, int h); + KTouchNormalKey(const TQChar& keyChar, const TQString& keyText, int x, int y, int w, int h); /// Destructor virtual ~KTouchNormalKey() {} /// Extends the painting routine of KTouchKey (adds the text). - void paint(QPainter& p) const; + void paint(TQPainter& p) const; /// Indicates the colour index in the colour scheme, that has to be used for this key /// and will be set in KTouchKeyboard::updateColors(). unsigned int m_colorIndex; @@ -101,11 +101,11 @@ class KTouchNormalKey : public KTouchBaseKey { class KTouchFingerKey : public KTouchNormalKey { public: /// Constructor - KTouchFingerKey(const QChar& keyChar, const QString& keyText, int x, int y, int w, int h); + KTouchFingerKey(const TQChar& keyChar, const TQString& keyText, int x, int y, int w, int h); /// Destructor ~KTouchFingerKey() { --m_fingerKeyCount; } /// Extends the painting algoritm of KTouchNormalKey when marked. - void paint(QPainter& p) const; + void paint(TQPainter& p) const; private: static int m_fingerKeyCount; ///< Contains the number of created finger keys (for colour generation). @@ -122,9 +122,9 @@ class KTouchFingerKey : public KTouchNormalKey { class KTouchControlKey : public KTouchBaseKey { public: /// Constructor - KTouchControlKey(const QChar& keyChar, const QString& keyText, int x, int y, int w, int h); + KTouchControlKey(const TQChar& keyChar, const TQString& keyText, int x, int y, int w, int h); /// Extends the parents paint routine (draws the text or other fancy stuff). - void paint(QPainter& p) const; + void paint(TQPainter& p) const; }; // ------------------------------------------------------------------------------------ @@ -136,16 +136,16 @@ class KTouchKeyConnection { /// Default constructor KTouchKeyConnection() : m_keyChar(0), m_targetKeyChar(0), m_fingerKeyChar(0), m_controlKeyChar(0) {} /// Constructor provided for convenience. - KTouchKeyConnection(const QChar& keyChar, const QChar& targetKeyChar, const QChar& fingerKeyChar, - const QChar& controlKeyChar) + KTouchKeyConnection(const TQChar& keyChar, const TQChar& targetKeyChar, const TQChar& fingerKeyChar, + const TQChar& controlKeyChar) : m_keyChar(keyChar), m_targetKeyChar(targetKeyChar), m_fingerKeyChar(fingerKeyChar), m_controlKeyChar(controlKeyChar) {} /// This is the character that has to be pressed to access this key. - QChar m_keyChar; + TQChar m_keyChar; - QChar m_targetKeyChar; ///< The target character (the key the user has to press). - QChar m_fingerKeyChar; ///< The finger key (where the used finger normally rests). - QChar m_controlKeyChar; ///< The modifier key the user has to press also (for example LeftShift). + TQChar m_targetKeyChar; ///< The target character (the key the user has to press). + TQChar m_fingerKeyChar; ///< The finger key (where the used finger normally rests). + TQChar m_controlKeyChar; ///< The modifier key the user has to press also (for example LeftShift). }; #endif // KTOUCHKEYS_H diff --git a/ktouch/src/ktouchlecture.cpp b/ktouch/src/ktouchlecture.cpp index 70195977..5f5d57de 100644 --- a/ktouch/src/ktouchlecture.cpp +++ b/ktouch/src/ktouchlecture.cpp @@ -12,29 +12,29 @@ #include "ktouchlecture.h" -#include <qfile.h> -#include <qtextstream.h> -#include <qstringlist.h> -#include <qdom.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqstringlist.h> +#include <tqdom.h> #include <kdebug.h> #include <klocale.h> #include <ktempfile.h> #include <kio/netaccess.h> -bool KTouchLecture::load(QWidget * window, const KURL& url) { +bool KTouchLecture::load(TQWidget * window, const KURL& url) { // Ok, first download the contents as usual using the KIO lib // File is only downloaded if not local, otherwise it's just opened - QString target; + TQString target; bool result = false; if (KIO::NetAccess::download(url, target, window)) { // Ok, that was successful, store the lectureURL and read the file - QFile infile(target); + TQFile infile(target); if ( !infile.open( IO_ReadOnly ) ) { KIO::NetAccess::removeTempFile(target); return false; // Bugger it... couldn't open it... } - QTextStream in( &infile ); + TQTextStream in( &infile ); result = readLecture(in); }; KIO::NetAccess::removeTempFile(target); @@ -42,19 +42,19 @@ bool KTouchLecture::load(QWidget * window, const KURL& url) { } // ---------------------------------------------------------------------------- -bool KTouchLecture::loadXML(QWidget * window, const KURL& url) { +bool KTouchLecture::loadXML(TQWidget * window, const KURL& url) { // Ok, first download the contents as usual using the KIO lib // File is only downloaded if not local, otherwise it's just opened - QString target; + TQString target; bool result = false; if (KIO::NetAccess::download(url, target, window)) { // Ok, that was successful, store the lectureURL and read the file - QFile infile(target); + TQFile infile(target); if ( !infile.open( IO_ReadOnly ) ) { KIO::NetAccess::removeTempFile(target); return false; // Bugger it... couldn't open it... } - QDomDocument doc; + TQDomDocument doc; doc.setContent( &infile ); result = readLecture(doc); } @@ -64,13 +64,13 @@ bool KTouchLecture::loadXML(QWidget * window, const KURL& url) { // ---------------------------------------------------------------------------- -bool KTouchLecture::saveXML(QWidget * window, const KURL& url) const { +bool KTouchLecture::saveXML(TQWidget * window, const KURL& url) const { // create the XML document - QDomDocument doc; + TQDomDocument doc; writeLecture(doc); // and save it - QString tmpFile; + TQString tmpFile; KTempFile *temp=0; if (url.isLocalFile()) tmpFile=url.path(); // for local files the path is sufficient @@ -80,14 +80,14 @@ bool KTouchLecture::saveXML(QWidget * window, const KURL& url) const { tmpFile=temp->name(); } - QFile outfile(tmpFile); + TQFile outfile(tmpFile); if ( !outfile.open( IO_WriteOnly ) ) { if (temp) delete temp; // kdDebug() << "Error creating lecture file!" << endl; return false; }; - QTextStream out( &outfile ); + TQTextStream out( &outfile ); out << doc.toString(); outfile.close(); // if we have a temporary file, we still need to upload it @@ -115,14 +115,14 @@ const KTouchLevelData& KTouchLecture::level(unsigned int levelNum) const { } // ---------------------------------------------------------------------------- -bool KTouchLecture::readLecture(QTextStream& in) { +bool KTouchLecture::readLecture(TQTextStream& in) { //kdDebug() << "[KTouchLecture::loadLecture] Reading lecture file '" << lectureURL.url() << "'!" << endl; - QString line; + TQString line; // remove everything else m_lectureData.clear(); // now loop until end of file is reached and break down the textfile into several strings containing the levels - QStringList slist; - QString current_level = QString::null; // used to store the current level data + TQStringList slist; + TQString current_level = TQString::null; // used to store the current level data line = in.readLine(); bool in_level = false; while (!in.atEnd() && !line.isNull()) { @@ -139,7 +139,7 @@ bool KTouchLecture::readLecture(QTextStream& in) { else if (in_level) { // ok, a new comment found, if we were reading a level, store it slist.append(current_level); - current_level = QString::null; + current_level = TQString::null; in_level = false; } } @@ -151,10 +151,10 @@ bool KTouchLecture::readLecture(QTextStream& in) { //kdDebug() << "Levels read = " << slist.count() << endl; // now read all the levels - for (QStringList::Iterator it = slist.begin(); it!=slist.end(); ++it) { + for (TQStringList::Iterator it = slist.begin(); it!=slist.end(); ++it) { // create new level KTouchLevelData level; - QTextStream t(&(*it), IO_ReadOnly); + TQTextStream t(&(*it), IO_ReadOnly); // try to read it if (!level.readLevel(t)) { // uh oh, error while reading level data @@ -175,11 +175,11 @@ bool KTouchLecture::readLecture(QTextStream& in) { } // ---------------------------------------------------------------------------- -bool KTouchLecture::readLecture(QDomDocument& doc) { - QString line; +bool KTouchLecture::readLecture(TQDomDocument& doc) { + TQString line; m_lectureData.clear(); // clean current data // retrieve the title - QDomNodeList entries = doc.elementsByTagName("Title"); + TQDomNodeList entries = doc.elementsByTagName("Title"); if (entries.count() >= 1) m_title = entries.item(0).firstChild().nodeValue(); else m_title = i18n("untitled lecture"); // retrieve the comment @@ -207,34 +207,34 @@ bool KTouchLecture::readLecture(QDomDocument& doc) { } // ---------------------------------------------------------------------------- -void KTouchLecture::writeLecture(QDomDocument& doc) const { - QDomElement root = doc.createElement( "KTouchLecture" ); +void KTouchLecture::writeLecture(TQDomDocument& doc) const { + TQDomElement root = doc.createElement( "KTouchLecture" ); doc.appendChild(root); // Store title and ensure that the file contains a title! - QDomElement title = doc.createElement("Title"); - QDomText titleText; + TQDomElement title = doc.createElement("Title"); + TQDomText titleText; if (m_title.isEmpty()) titleText = doc.createTextNode( i18n("untitled lecture") ); else titleText = doc.createTextNode(m_title); title.appendChild(titleText); root.appendChild(title); // Store comment if given if (!m_comment.isEmpty()) { - QDomElement comment = doc.createElement("Comment"); - QDomText commentText = doc.createTextNode(m_comment); + TQDomElement comment = doc.createElement("Comment"); + TQDomText commentText = doc.createTextNode(m_comment); comment.appendChild(commentText); root.appendChild(comment); } // Store font suggestion if given if (!m_fontSuggestions.isEmpty()) { - QDomElement font = doc.createElement("FontSuggestions"); - QDomText fontText = doc.createTextNode(m_fontSuggestions); + TQDomElement font = doc.createElement("FontSuggestions"); + TQDomText fontText = doc.createTextNode(m_fontSuggestions); font.appendChild(fontText); root.appendChild(font); } // Store levels - QDomElement levels = doc.createElement("Levels"); + TQDomElement levels = doc.createElement("Levels"); root.appendChild(levels); - for (QValueVector<KTouchLevelData>::const_iterator it=m_lectureData.begin(); + for (TQValueVector<KTouchLevelData>::const_iterator it=m_lectureData.begin(); it!=m_lectureData.end(); ++it) { it->writeLevel(doc, levels); @@ -247,8 +247,8 @@ void KTouchLecture::writeLecture(QDomDocument& doc) const { // OLD and deprecated stuff /* -bool KTouchLecture::save(QWidget * window, const KURL& url) const { - QString tmpFile; +bool KTouchLecture::save(TQWidget * window, const KURL& url) const { + TQString tmpFile; KTempFile *temp=0; if (url.isLocalFile()) tmpFile=url.path(); // for local files the path is sufficient @@ -258,13 +258,13 @@ bool KTouchLecture::save(QWidget * window, const KURL& url) const { tmpFile=temp->name(); } - QFile outfile(tmpFile); + TQFile outfile(tmpFile); if ( !outfile.open( IO_WriteOnly ) ) { if (temp) delete temp; // kdDebug() << "Error creating lecture file!" << endl; return false; }; - QTextStream out( &outfile ); + TQTextStream out( &outfile ); writeLecture(out); // TODO : check stream status to see if save worked outfile.close(); @@ -277,7 +277,7 @@ bool KTouchLecture::save(QWidget * window, const KURL& url) const { } // ---------------------------------------------------------------------------- -void KTouchLecture::writeLecture(QTextStream& out) const { +void KTouchLecture::writeLecture(TQTextStream& out) const { out << "###################################### " << endl; out << "# # " << endl; out << "# Training lecture file for KTouch # " << endl; @@ -287,7 +287,7 @@ void KTouchLecture::writeLecture(QTextStream& out) const { out << endl; int levelCounter=0; - for (QValueVector<KTouchLevelData>::const_iterator it=m_lectureData.begin(); it!=m_lectureData.end(); ++it) { + for (TQValueVector<KTouchLevelData>::const_iterator it=m_lectureData.begin(); it!=m_lectureData.end(); ++it) { out << "################################" << endl; out << "# Level: " << ++levelCounter << endl; out << "# " << endl; diff --git a/ktouch/src/ktouchlecture.h b/ktouch/src/ktouchlecture.h index 3c59ee08..3eb6ba54 100644 --- a/ktouch/src/ktouchlecture.h +++ b/ktouch/src/ktouchlecture.h @@ -21,7 +21,7 @@ class QWidget; class QDomDocument; class KURL; -#include <qvaluevector.h> +#include <tqvaluevector.h> #include "ktouchleveldata.h" /// This class handles the lecture data and provides the lines to type. @@ -41,13 +41,13 @@ class KTouchLecture { /// Creates a default mini-lecture. void createDefault(); /// Loads a lecture from file (returns true if successful). - bool load(QWidget * window, const KURL& url); + bool load(TQWidget * window, const KURL& url); /// Loads a lecture (in XML format) from file (returns true if successful). - bool loadXML(QWidget * window, const KURL& url); + bool loadXML(TQWidget * window, const KURL& url); // /// Saves the lecture data to file (returns true if successful). - // bool save(QWidget * window, const KURL& url) const; + // bool save(TQWidget * window, const KURL& url) const; /// Saves the lecture data to file (returns true if successful). - bool saveXML(QWidget * window, const KURL& url) const; + bool saveXML(TQWidget * window, const KURL& url) const; /// Returns the number of levels in the lecture. unsigned int levelCount() const { return m_lectureData.size(); } /// Returns a reference to the data of the level. @@ -55,25 +55,25 @@ class KTouchLecture { /// the level 0. const KTouchLevelData& level(unsigned int levelNum) const; /// Returns the title of the lecture. - const QString& title() const { return m_title; } + const TQString& title() const { return m_title; } /// Sets the title of the lecture. - void setTitle(const QString& title) { m_title = title; } + void setTitle(const TQString& title) { m_title = title; } - QString m_title; ///< The title of the lecture. - QString m_comment; ///< A comment. - QString m_fontSuggestions; ///< Font suggestions for this lecture. + TQString m_title; ///< The title of the lecture. + TQString m_comment; ///< A comment. + TQString m_fontSuggestions; ///< Font suggestions for this lecture. private: /// Loads a lecture from file - bool readLecture(QTextStream& in); + bool readLecture(TQTextStream& in); /// Loads a lecture from file into an XML document - bool readLecture(QDomDocument& doc); + bool readLecture(TQDomDocument& doc); /// Saves the lecture data to the current lecture URL - void writeLecture(QTextStream& out) const; + void writeLecture(TQTextStream& out) const; /// Saves the lecture data in the XML document - void writeLecture(QDomDocument& doc) const; + void writeLecture(TQDomDocument& doc) const; - QValueVector<KTouchLevelData> m_lectureData; ///< The lecture data. + TQValueVector<KTouchLevelData> m_lectureData; ///< The lecture data. /// The editor should be able to handle the internal lecture data (it's for convenience actually). friend class KTouchLectureEditor; diff --git a/ktouch/src/ktouchlectureeditor.cpp b/ktouch/src/ktouchlectureeditor.cpp index ce433d8c..e274732b 100644 --- a/ktouch/src/ktouchlectureeditor.cpp +++ b/ktouch/src/ktouchlectureeditor.cpp @@ -11,9 +11,9 @@ ***************************************************************************/ -#include <qlabel.h> -#include <qstring.h> -#include <qstringlist.h> +#include <tqlabel.h> +#include <tqstring.h> +#include <tqstringlist.h> #include <kpushbutton.h> #include <klistview.h> @@ -41,23 +41,23 @@ // ***** Public functions *** // ************************** -KTouchLectureEditor::KTouchLectureEditor(QWidget *parent, const char* name, bool modal, WFlags fl) +KTouchLectureEditor::KTouchLectureEditor(TQWidget *parent, const char* name, bool modal, WFlags fl) : KTouchLectureEditorDlg(parent, name, modal, fl) { levelListView->setSorting(-1); // don't sort my level list view! - connect(levelListView, SIGNAL(selectionChanged(QListViewItem*)),this, SLOT(newSelection(QListViewItem*)) ); - connect(newCharsEdit, SIGNAL(textChanged(const QString&)), this, SLOT(newCharsChanged(const QString&)) ); - connect(newBtn, SIGNAL(clicked()), this, SLOT(newLevel()) ); - connect(deleteBtn, SIGNAL(clicked()), this, SLOT(deleteLevel()) ); - connect(upBtn, SIGNAL(clicked()), this, SLOT(moveUp()) ); - connect(downBtn, SIGNAL(clicked()), this, SLOT(moveDown()) ); + connect(levelListView, TQT_SIGNAL(selectionChanged(TQListViewItem*)),this, TQT_SLOT(newSelection(TQListViewItem*)) ); + connect(newCharsEdit, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(newCharsChanged(const TQString&)) ); + connect(newBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(newLevel()) ); + connect(deleteBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(deleteLevel()) ); + connect(upBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(moveUp()) ); + connect(downBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(moveDown()) ); // make the connections for making the lecture modified - connect(titleEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setModified()) ); - connect(lectureCommentEdit, SIGNAL(textChanged()), this, SLOT(setModified()) ); - connect(levelCommentEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setModified()) ); - connect(linesTextEdit, SIGNAL(textChanged()), this, SLOT(setModified()) ); + connect(titleEdit, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(setModified()) ); + connect(lectureCommentEdit, TQT_SIGNAL(textChanged()), this, TQT_SLOT(setModified()) ); + connect(levelCommentEdit, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(setModified()) ); + connect(linesTextEdit, TQT_SIGNAL(textChanged()), this, TQT_SLOT(setModified()) ); // The font, open, save, saveas and close buttons are already connected } @@ -66,7 +66,7 @@ KTouchLectureEditor::KTouchLectureEditor(QWidget *parent, const char* name, bool bool KTouchLectureEditor::startEditor(const KURL& url) { // call open request dialog and load a lecture, and start the dialogs event loop if // the user did not cancel the open request dialog - if (openLectureFile(url)==QDialog::Accepted) { + if (openLectureFile(url)==TQDialog::Accepted) { exec(); return true; } @@ -80,8 +80,8 @@ bool KTouchLectureEditor::startEditor(const KURL& url) { // ************************* void KTouchLectureEditor::fontBtnClicked() { - QFont f(m_lecture.m_fontSuggestions); - if (KFontDialog::getFont(f, false, this, true)==QDialog::Accepted) { + TQFont f(m_lecture.m_fontSuggestions); + if (KFontDialog::getFont(f, false, this, true)==TQDialog::Accepted) { linesTextEdit->setFont(f); lectureCommentEdit->setFont(f); levelCommentEdit->setFont(f); @@ -111,7 +111,7 @@ void KTouchLectureEditor::saveBtnClicked() { // ----------------------------------------------------------------------------- void KTouchLectureEditor::saveAsBtnClicked() { - QString tmp = KFileDialog::getSaveFileName(QString::null, + TQString tmp = KFileDialog::getSaveFileName(TQString::null, "*.ktouch.xml|KTouch Lecture Files(*.ktouch.xml)\n*.*|All Files", this, i18n("Save Training Lecture") ); if (!tmp.isEmpty()) { transfer_from_dialog(); @@ -123,13 +123,13 @@ void KTouchLectureEditor::saveAsBtnClicked() { } // ----------------------------------------------------------------------------- -void KTouchLectureEditor::newSelection(QListViewItem* item) { +void KTouchLectureEditor::newSelection(TQListViewItem* item) { if (m_selecting) return; bool current_modified_flag = m_modified; // remember our current status // first store the current level data storeCurrentLevel(); // now we need to find the level which has been selected - QListViewItem *i = levelListView->firstChild(); + TQListViewItem *i = levelListView->firstChild(); unsigned int level=0; while (i!=0 && i!=item) { i = i->nextSibling(); @@ -158,7 +158,7 @@ void KTouchLectureEditor::newSelection(QListViewItem* item) { } // ----------------------------------------------------------------------------- -void KTouchLectureEditor::newCharsChanged(const QString& text) { +void KTouchLectureEditor::newCharsChanged(const TQString& text) { if (m_currentItem==0) return; // shouldn't happen, but a little bit of paranoia... m_currentItem->setText(0, text); setModified(); @@ -167,7 +167,7 @@ void KTouchLectureEditor::newCharsChanged(const QString& text) { void KTouchLectureEditor::newLevel() { createNewLevel(); - QListViewItem *newItem = new QListViewItem( levelListView, + TQListViewItem *newItem = new TQListViewItem( levelListView, levelListView->lastItem(), m_lecture.m_lectureData.back().m_newChars ); newSelection(newItem); upBtn->setEnabled(true); @@ -184,7 +184,7 @@ void KTouchLectureEditor::deleteLevel() { // first remove the item from the list view delete m_currentItem; // then remove the level data - QValueVector<KTouchLevelData>::iterator it=m_lecture.m_lectureData.begin(); + TQValueVector<KTouchLevelData>::iterator it=m_lecture.m_lectureData.begin(); std::advance(it, m_level); m_lecture.m_lectureData.erase(it); m_currentItem = levelListView->firstChild(); @@ -207,7 +207,7 @@ void KTouchLectureEditor::moveUp() { if (m_level==0) return; m_selecting=true; // again, I don't want to process changeSelection() signals now storeCurrentLevel(); - QListViewItem *upperItem = m_currentItem->itemAbove(); + TQListViewItem *upperItem = m_currentItem->itemAbove(); std::swap(m_lecture.m_lectureData[m_level], m_lecture.m_lectureData[m_level-1]); upperItem->setText(0, m_lecture.m_lectureData[m_level-1].m_newChars); m_currentItem->setText(0, m_lecture.m_lectureData[m_level].m_newChars); @@ -227,7 +227,7 @@ void KTouchLectureEditor::moveDown() { if (m_level>=m_lecture.m_lectureData.size()-1) return; m_selecting=true; // again, I don't want to process changeSelection() signals now storeCurrentLevel(); - QListViewItem *lowerItem = m_currentItem->itemBelow(); + TQListViewItem *lowerItem = m_currentItem->itemBelow(); std::swap(m_lecture.m_lectureData[m_level], m_lecture.m_lectureData[m_level+1]); m_currentItem->setText(0, m_lecture.m_lectureData[m_level].m_newChars); lowerItem->setText(0, m_lecture.m_lectureData[m_level+1].m_newChars); @@ -258,12 +258,12 @@ void KTouchLectureEditor::transfer_to_dialog() { else setCaption(i18n("KTouch Lecture Editor - ") + m_currentURL.fileName()); // copy the 'new char' strings of the lectures into the list view levelListView->clear(); - QValueVector<KTouchLevelData>::const_iterator it=m_lecture.m_lectureData.begin(); + TQValueVector<KTouchLevelData>::const_iterator it=m_lecture.m_lectureData.begin(); // add first item - QListViewItem *item=new QListViewItem( levelListView, (it++)->m_newChars ); + TQListViewItem *item=new TQListViewItem( levelListView, (it++)->m_newChars ); // add all the others for (;it!=m_lecture.m_lectureData.end(); ++it) - item = new QListViewItem( levelListView, item, it->m_newChars ); + item = new TQListViewItem( levelListView, item, it->m_newChars ); m_currentItem=levelListView->firstChild(); m_selecting = true; // prevent the selectionChanged() signal from interfering levelListView->setSelected(m_currentItem, true); @@ -283,7 +283,7 @@ void KTouchLectureEditor::transfer_to_dialog() { } // finally the font if (!m_lecture.m_fontSuggestions.isEmpty()) { - QFont f("Monospace"); + TQFont f("Monospace"); // TODO : multiple font suggestions f.fromString(m_lecture.m_fontSuggestions); linesTextEdit->setFont(f); @@ -310,8 +310,8 @@ void KTouchLectureEditor::showCurrentLevel() { levelLabel->setText(i18n("Data of Level %1").arg(m_level+1) ); levelCommentEdit->setText(m_lecture.m_lectureData[m_level].m_comment); newCharsEdit->setText(m_lecture.m_lectureData[m_level].m_newChars); - QString text; - for (QValueVector<QString>::const_iterator it=m_lecture.m_lectureData[m_level].m_lines.begin(); + TQString text; + for (TQValueVector<TQString>::const_iterator it=m_lecture.m_lectureData[m_level].m_lines.begin(); it!=m_lecture.m_lectureData[m_level].m_lines.end(); ++it) { text += *it + '\n'; @@ -325,11 +325,11 @@ void KTouchLectureEditor::storeCurrentLevel() { m_lecture.m_lectureData[m_level].m_comment = levelCommentEdit->text(); m_lecture.m_lectureData[m_level].m_newChars = newCharsEdit->text(); m_lecture.m_lectureData[m_level].m_lines.clear(); - QString text = linesTextEdit->text(); - QStringList lines; - QString currentLine; + TQString text = linesTextEdit->text(); + TQStringList lines; + TQString currentLine; for (unsigned int i=0; i<text.length(); ++i) { - QChar c = text[i]; + TQChar c = text[i]; if (c=='\t') c=' '; // replace tabs with spaces if (c=='\n') { lines.append(currentLine); @@ -339,7 +339,7 @@ void KTouchLectureEditor::storeCurrentLevel() { currentLine += c; }; lines.append(currentLine); - for (QStringList::const_iterator it=lines.begin(); it!=lines.end(); ++it) { + for (TQStringList::const_iterator it=lines.begin(); it!=lines.end(); ++it) { if ((*it).isEmpty()) continue; m_lecture.m_lectureData[m_level].m_lines.push_back(*it); } @@ -349,7 +349,7 @@ void KTouchLectureEditor::storeCurrentLevel() { void KTouchLectureEditor::createNewLevel() { KTouchLevelData newLevel; newLevel.m_newChars = i18n("abcdefghijklmnopqrstuvwxyz"); - newLevel.m_comment = QString(); + newLevel.m_comment = TQString(); newLevel.m_lines.clear(); // remove the lines of the default mini level newLevel.m_lines.push_back(i18n("Enter your lines here...")); m_lecture.m_lectureData.push_back(newLevel); @@ -370,7 +370,7 @@ int KTouchLectureEditor::openLectureFile(const KURL& url) { i18n("Create new lecture"), url, KTouchPtr->lectureFiles(), i18n("<no lecture files available>")); - if (result == QDialog::Accepted) { + if (result == TQDialog::Accepted) { // Ok, user confirmed the dialog, now lets get the url m_currentURL = new_url; // Try to load the lecture, if that failes, we create a new lecture instead @@ -379,7 +379,7 @@ int KTouchLectureEditor::openLectureFile(const KURL& url) { // try to read old format first then XML format if (!m_lecture.load(this, m_currentURL) && !m_lecture.loadXML(this, m_currentURL)) { KMessageBox::sorry(this, i18n("Could not open the lecture file, creating a new one instead.")); - m_currentURL = QString::null; // new lectures haven't got a URL + m_currentURL = TQString::null; // new lectures haven't got a URL } } // If we have no URL, we create a new lecture - can happen if either the user @@ -392,9 +392,9 @@ int KTouchLectureEditor::openLectureFile(const KURL& url) { m_modified = false; // newly read lectures are not modified in the begin // Update our editor with the lecture data transfer_to_dialog(); - return QDialog::Accepted; + return TQDialog::Accepted; } - else return QDialog::Rejected; + else return TQDialog::Rejected; } // ----------------------------------------------------------------------------- @@ -411,7 +411,7 @@ bool KTouchLectureEditor::saveModified() { if (!m_modified) return true; // ok, ask the user to save the changes int result = KMessageBox::questionYesNoCancel(this, - i18n("The lecture has been changed. Do you want to save the changes?"),QString::null,KStdGuiItem::save(),KStdGuiItem::discard()); + i18n("The lecture has been changed. Do you want to save the changes?"),TQString::null,KStdGuiItem::save(),KStdGuiItem::discard()); if (result == KMessageBox::Cancel) return false; // User aborted if (result == KMessageBox::Yes) saveBtnClicked(); // if successfully saved the modified flag will be resetted in the saveBtnClicked() function diff --git a/ktouch/src/ktouchlectureeditor.h b/ktouch/src/ktouchlectureeditor.h index 49850b6b..46d944b2 100644 --- a/ktouch/src/ktouchlectureeditor.h +++ b/ktouch/src/ktouchlectureeditor.h @@ -17,8 +17,8 @@ #include <config.h> #endif -#include <qwidget.h> -#include <qfont.h> +#include <tqwidget.h> +#include <tqfont.h> #include <kurl.h> #include "ktouchlectureeditor_dlg.h" @@ -43,7 +43,7 @@ class KTouchLectureEditor : public KTouchLectureEditorDlg { Q_OBJECT public: /// Constructor - KTouchLectureEditor(QWidget *parent, const char* name = 0, bool modal = FALSE, WFlags fl = 0); + KTouchLectureEditor(TQWidget *parent, const char* name = 0, bool modal = FALSE, WFlags fl = 0); /// Destructor ~KTouchLectureEditor() {} /// Shows and executes the dialog (argument is the url to the default or @@ -69,9 +69,9 @@ class KTouchLectureEditor : public KTouchLectureEditorDlg { /// Will be called whenever some changes are made. void setModified() { setModified(true); } /// Will be called whenever another level has been selected. - void newSelection(QListViewItem* item); + void newSelection(TQListViewItem* item); /// Will be called whenever the new chars description is changed. - void newCharsChanged(const QString& text); + void newCharsChanged(const TQString& text); /// Will be called when the "New Level" button has been clicked. void newLevel(); /// Will be called when the "Delete Level" button has been clicked. @@ -108,7 +108,7 @@ class KTouchLectureEditor : public KTouchLectureEditorDlg { KTouchLecture m_lecture; ///< The currently used lecture. unsigned int m_level; ///< The current level number. - QListViewItem *m_currentItem; ///< The currently selected item in the list view. + TQListViewItem *m_currentItem; ///< The currently selected item in the list view. bool m_selecting; ///< Flag to prevent the selection slot from selecting twice. bool m_modified; ///< Flag indicating whether the lecture has been modified. KURL m_currentURL; ///< URL of the current lecture. diff --git a/ktouch/src/ktouchleveldata.cpp b/ktouch/src/ktouchleveldata.cpp index c74c5d10..d0606442 100644 --- a/ktouch/src/ktouchleveldata.cpp +++ b/ktouch/src/ktouchleveldata.cpp @@ -11,13 +11,13 @@ ***************************************************************************/ #include "ktouchleveldata.h" -#include <qiodevice.h> -#include <qdom.h> +#include <tqiodevice.h> +#include <tqdom.h> #include <klocale.h> #include <kdebug.h> -#include <qstringlist.h> +#include <tqstringlist.h> -const QString& KTouchLevelData::line(unsigned int lineNumber) const { +const TQString& KTouchLevelData::line(unsigned int lineNumber) const { if (lineNumber>=m_lines.size()) lineNumber=0; return m_lines[lineNumber]; @@ -26,19 +26,19 @@ const QString& KTouchLevelData::line(unsigned int lineNumber) const { void KTouchLevelData::createDefault() { m_newChars = i18n("Quite a lot"); m_lines.clear(); - QString text = i18n("This is a small default text. If you want\n" + TQString text = i18n("This is a small default text. If you want\n" "to start practicing touch typing, open\n" "a lecture/training file from the main menu.\n" "If you press enter after the next line you have\n" "successfully completed the default lecture. Hurray!!!"); - QStringList l( QStringList::split(QChar('\n'), text) ); - for (QStringList::const_iterator it = l.constBegin(); it != l.constEnd(); ++it) + TQStringList l( TQStringList::split(TQChar('\n'), text) ); + for (TQStringList::const_iterator it = l.constBegin(); it != l.constEnd(); ++it) m_lines.push_back( *it ); } -bool KTouchLevelData::readLevel(QTextStream& in) { - QString line; - m_comment = m_newChars = QString::null; +bool KTouchLevelData::readLevel(TQTextStream& in) { + TQString line; + m_comment = m_newChars = TQString::null; m_lines.clear(); // now read all the lines of the level, until EOF or an empty line line = in.readLine(); @@ -62,16 +62,16 @@ bool KTouchLevelData::readLevel(QTextStream& in) { return true; } -bool KTouchLevelData::readLevel(QDomNode in) { - QDomNode newChars = in.namedItem("NewCharacters"); +bool KTouchLevelData::readLevel(TQDomNode in) { + TQDomNode newChars = in.namedItem("NewCharacters"); if (newChars.isNull()) m_newChars = i18n("basically all characters on the keyboard","abcdefghijklmnopqrstuvwxyz"); else m_newChars = newChars.firstChild().nodeValue(); - QDomNode levelComment = in.namedItem("LevelComment"); + TQDomNode levelComment = in.namedItem("LevelComment"); if (!levelComment.isNull()) m_comment = levelComment.firstChild().nodeValue(); m_lines.clear(); - QDomNode line = in.namedItem("Line"); + TQDomNode line = in.namedItem("Line"); while ( !line.isNull() ) { - QString l = line.firstChild().nodeValue(); + TQString l = line.firstChild().nodeValue(); m_lines.push_back( l.stripWhiteSpace() ); line = line.nextSibling(); } @@ -82,27 +82,27 @@ bool KTouchLevelData::readLevel(QDomNode in) { return true; } -void KTouchLevelData::writeLevel(QTextStream& out) const { +void KTouchLevelData::writeLevel(TQTextStream& out) const { out << "# Comment: " << m_comment << endl; // comment line out << m_newChars << endl; // new characters line - for (QValueVector<QString>::const_iterator it=m_lines.begin(); it!=m_lines.end(); ++it) + for (TQValueVector<TQString>::const_iterator it=m_lines.begin(); it!=m_lines.end(); ++it) out << *it << endl; out << endl; } -void KTouchLevelData::writeLevel(QDomDocument& doc, QDomElement& root) const { - QDomElement level = doc.createElement("Level"); +void KTouchLevelData::writeLevel(TQDomDocument& doc, TQDomElement& root) const { + TQDomElement level = doc.createElement("Level"); root.appendChild(level); // comment (optional) if (!m_comment.isEmpty()) { - QDomElement comment = doc.createElement("LevelComment"); - QDomText commentText = doc.createTextNode(m_comment); + TQDomElement comment = doc.createElement("LevelComment"); + TQDomText commentText = doc.createTextNode(m_comment); comment.appendChild(commentText); level.appendChild(comment); } // new characters (must have that) - QDomElement newchars = doc.createElement("NewCharacters"); - QDomText newcharsText; + TQDomElement newchars = doc.createElement("NewCharacters"); + TQDomText newcharsText; if (m_newChars.isEmpty()) newcharsText = doc.createTextNode(i18n("basically all characters on the keyboard","abcdefghijklmnopqrstuvwxyz")); else @@ -110,9 +110,9 @@ void KTouchLevelData::writeLevel(QDomDocument& doc, QDomElement& root) const { newchars.appendChild(newcharsText); level.appendChild(newchars); // the lines - for (QValueVector<QString>::const_iterator it=m_lines.begin(); it!=m_lines.end(); ++it) { - QDomElement line = doc.createElement("Line"); - QDomText lineText = doc.createTextNode(*it); + for (TQValueVector<TQString>::const_iterator it=m_lines.begin(); it!=m_lines.end(); ++it) { + TQDomElement line = doc.createElement("Line"); + TQDomText lineText = doc.createTextNode(*it); line.appendChild(lineText); level.appendChild(line); } diff --git a/ktouch/src/ktouchleveldata.h b/ktouch/src/ktouchleveldata.h index 8055824d..e7e0f5e1 100644 --- a/ktouch/src/ktouchleveldata.h +++ b/ktouch/src/ktouchleveldata.h @@ -17,10 +17,10 @@ #include <config.h> #endif -#include <qstring.h> -#include <qtextstream.h> -#include <qvaluevector.h> -#include <qdom.h> +#include <tqstring.h> +#include <tqtextstream.h> +#include <tqvaluevector.h> +#include <tqdom.h> class QDomDocument; class QDomElement; @@ -41,16 +41,16 @@ class KTouchLevelData { /// Default constructor, creates a default level. KTouchLevelData() { createDefault(); } /// Constructor for creating a new level. - KTouchLevelData(const QString& comment, const QString& newChars) + KTouchLevelData(const TQString& comment, const TQString& newChars) : m_comment(comment), m_newChars(newChars) { createDefault(); } /// Returns the level description (comment). - const QString& comment() const { return m_comment; } + const TQString& comment() const { return m_comment; } /// Returns the new characters string. - const QString& newChars() const { return m_newChars; } + const TQString& newChars() const { return m_newChars; } /// Returns the line with number 'lineNumber' (0 means first line). /// /// If the line number is out of range, the first line will be returned. - const QString& line(unsigned int lineNumber) const; + const TQString& line(unsigned int lineNumber) const; /// Returns the number of lines. unsigned int count() const { return m_lines.size(); } @@ -59,18 +59,18 @@ class KTouchLevelData { void createDefault(); /// Reads a level from the input stream. /// @return Returns 'true', when a level could be read successfully, or 'false' otherwise. - bool readLevel(QTextStream& in); + bool readLevel(TQTextStream& in); /// Reads a level from a XML Dom Node. /// @return Returns 'true', when a level could be read successfully, or 'false' otherwise. - bool readLevel(QDomNode in); + bool readLevel(TQDomNode in); /// Writes the level data into the output stream. - void writeLevel(QTextStream& out) const; + void writeLevel(TQTextStream& out) const; /// Writes the level data into the output stream. - void writeLevel(QDomDocument& doc, QDomElement& root) const; + void writeLevel(TQDomDocument& doc, TQDomElement& root) const; - QString m_comment; ///< A comment for the level. - QString m_newChars; ///< Contains the newly introduced characters in this level. - QValueVector<QString> m_lines; ///< The lines of the level. + TQString m_comment; ///< A comment for the level. + TQString m_newChars; ///< Contains the newly introduced characters in this level. + TQValueVector<TQString> m_lines; ///< The lines of the level. // so I don't have to allow access to read/write function to everybody :-) friend class KTouchLecture; diff --git a/ktouch/src/ktouchopenrequest.cpp b/ktouch/src/ktouchopenrequest.cpp index d4bc875b..eb82f3f8 100644 --- a/ktouch/src/ktouchopenrequest.cpp +++ b/ktouch/src/ktouchopenrequest.cpp @@ -10,9 +10,9 @@ * (at your option) any later version. * ***************************************************************************/ -#include <qradiobutton.h> -#include <qlabel.h> -#include <qbuttongroup.h> +#include <tqradiobutton.h> +#include <tqlabel.h> +#include <tqbuttongroup.h> #include <kpushbutton.h> #include <klineedit.h> @@ -26,14 +26,14 @@ #include "ktouchopenrequest.h" #include "ktouchopenrequest.moc" -KTouchOpenRequest::KTouchOpenRequest(QWidget* parent, const char* name, bool modal, WFlags fl) +KTouchOpenRequest::KTouchOpenRequest(TQWidget* parent, const char* name, bool modal, WFlags fl) : KTouchOpenRequestDlg(parent,name, modal,fl) { } -int KTouchOpenRequest::requestFileToOpen(KURL& url, const QString& caption, const QString& title, - const QString& currentText, const QString& defaultText, const QString& openText, - const QString& newText, KURL current_url, QStringList defaultList, QString emptyListText) +int KTouchOpenRequest::requestFileToOpen(KURL& url, const TQString& caption, const TQString& title, + const TQString& currentText, const TQString& defaultText, const TQString& openText, + const TQString& newText, KURL current_url, TQStringList defaultList, TQString emptyListText) { setCaption(caption); openChoiceGroup->setTitle(title); @@ -60,7 +60,7 @@ int KTouchOpenRequest::requestFileToOpen(KURL& url, const QString& caption, cons presetRadioBtn->setEnabled(false); } else { - for (QStringList::Iterator it = defaultList.begin(); it != defaultList.end(); ++it ) + for (TQStringList::Iterator it = defaultList.begin(); it != defaultList.end(); ++it ) presetCombo->insertItem(*it); presetRadioBtn->setEnabled(true); } @@ -79,7 +79,7 @@ void KTouchOpenRequest::okBtnClicked() { if (presetRadioBtn->isChecked()) m_url = presetCombo->currentText(); if (newRadioBtn->isChecked()) - m_url = QString::null; + m_url = TQString::null; if (openFileRadioBtn->isChecked()) { if (openFileEdit->text().isEmpty()) { KMessageBox::error(this, i18n("Please select or enter a file name.")); @@ -92,7 +92,7 @@ void KTouchOpenRequest::okBtnClicked() { } m_url = tmp; }; - QDialog::accept(); + TQDialog::accept(); } @@ -113,7 +113,7 @@ void KTouchOpenRequest::radioBtnChanged() { void KTouchOpenRequest::browseBtnClicked() { - KURL tmp = KFileDialog::getOpenURL(QString::null, QString::null, this, i18n("Select Training Lecture File") ); + KURL tmp = KFileDialog::getOpenURL(TQString::null, TQString::null, this, i18n("Select Training Lecture File") ); if (!tmp.isEmpty()) openFileEdit->setText(tmp.url()); } diff --git a/ktouch/src/ktouchopenrequest.h b/ktouch/src/ktouchopenrequest.h index 5c7d78a3..8f1c31d0 100644 --- a/ktouch/src/ktouchopenrequest.h +++ b/ktouch/src/ktouchopenrequest.h @@ -20,7 +20,7 @@ #include "ktouchopenrequest_dlg.h" #include <kurl.h> -#include <qstringlist.h> +#include <tqstringlist.h> /// Dialog for selecting a file to open. /// @@ -35,14 +35,14 @@ /// KTouchOpenRequest dlg; /// KURL url; /// // current_lecture must hold the URL to the current/default lecture or "" -/// // default_lectures must be a QStringList with the default lecture files. +/// // default_lectures must be a TQStringList with the default lecture files. /// int result = dlg.requestFileToOpen(url, i18n("Open a lecture file"), /// i18n("Which lecture would you like to open?"), i18n("Current lecture:"), /// i18n("Open a default lecture:"), i18n("Open a lecture file:"), /// i18n("Create a new lecture!"), current_lecture, /// default_lectures, i18n("<no lecture files available>")); /// -/// if (result==QDialog::Accepted) { +/// if (result==TQDialog::Accepted) { /// doSomethingFancyWith(url); /// } /// @endcode @@ -55,14 +55,14 @@ class KTouchOpenRequest : public KTouchOpenRequestDlg { public: /// Default constructor. - KTouchOpenRequest(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + KTouchOpenRequest(TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); /// Default destructor. ~KTouchOpenRequest() {} /// Sets up the dialog and runs it. - /// @return Returns the dialogs return code, QDialog::Accepted or QDialog::Rejected. - int requestFileToOpen(KURL& url, const QString& caption, const QString& title, const QString& currentText, - const QString& defaultText, const QString& openText, const QString& newText, - KURL current_url = QString::null, QStringList defaultList = QStringList(), QString emptyListText = QString::null); + /// @return Returns the dialogs return code, TQDialog::Accepted or TQDialog::Rejected. + int requestFileToOpen(KURL& url, const TQString& caption, const TQString& title, const TQString& currentText, + const TQString& defaultText, const TQString& openText, const TQString& newText, + KURL current_url = TQString::null, TQStringList defaultList = TQStringList(), TQString emptyListText = TQString::null); /// After the dialog has been accepted the URL chosen by the user is stored herein. KURL m_url; diff --git a/ktouch/src/ktouchslideline.cpp b/ktouch/src/ktouchslideline.cpp index aa245b4b..3071cc52 100644 --- a/ktouch/src/ktouchslideline.cpp +++ b/ktouch/src/ktouchslideline.cpp @@ -13,8 +13,8 @@ #include "ktouchslideline.h" #include "ktouchslideline.moc" -#include <qpainter.h> -#include <qpixmap.h> +#include <tqpainter.h> +#include <tqpixmap.h> #include <kdebug.h> #include <cmath> @@ -41,8 +41,8 @@ // --- don't touch the lines above --- -KTouchSlideLine::KTouchSlideLine(QWidget *parent) - : QWidget( parent ), +KTouchSlideLine::KTouchSlideLine(TQWidget *parent) + : TQWidget( parent ), m_teacherPixmap(NULL), m_studentPixmap(NULL), m_slideTimer(this), @@ -77,8 +77,8 @@ KTouchSlideLine::KTouchSlideLine(QWidget *parent) m_xFrameStudent = 0; m_xFrameStudentCurrent = 0; - connect( &m_cursorTimer, SIGNAL(timeout()), this, SLOT(toggleCursor()) ); - connect( &m_slideTimer, SIGNAL(timeout()), this, SLOT(slide()) ); + connect( &m_cursorTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(toggleCursor()) ); + connect( &m_slideTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slide()) ); } // ---------------------------------------------------------------------------- @@ -105,7 +105,7 @@ void KTouchSlideLine::applyPreferences() { } // ---------------------------------------------------------------------------- -void KTouchSlideLine::setNewText(const QString& teacher_text, const QString& student_text) { +void KTouchSlideLine::setNewText(const TQString& teacher_text, const TQString& student_text) { KD_DEBUG( "[KTouchSlideLine::setNewText]" << endl ); m_teacherText=teacher_text; @@ -117,14 +117,14 @@ void KTouchSlideLine::setNewText(const QString& teacher_text, const QString& stu } // ---------------------------------------------------------------------------- -void KTouchSlideLine::setStudentText(const QString& text) { +void KTouchSlideLine::setStudentText(const TQString& text) { KD_DEBUG( "[KTouchSlideLine::setStudentText]" << endl ); m_studentText=text; updateStudentLine(); } // ---------------------------------------------------------------------------- -void KTouchSlideLine::setFont(const QFont& font) { +void KTouchSlideLine::setFont(const TQFont& font) { KD_DEBUG( "[KTouchSlideLine::setFont]" << endl ); // set the font for the slide line, unless the configuration overrides it if (Prefs::overrideLectureFont()) m_font = Prefs::font(); @@ -136,8 +136,8 @@ void KTouchSlideLine::setFont(const QFont& font) { } // ---------------------------------------------------------------------------- -bool KTouchSlideLine::canAddCharacter(const QString& new_student_text) { - QFontMetrics fontMetrics( m_font ); +bool KTouchSlideLine::canAddCharacter(const TQString& new_student_text) { + TQFontMetrics fontMetrics( m_font ); int new_text_len = textLen(fontMetrics, new_student_text); int allowed_student_length = m_studentPixmap->width() - 2*m_marginCursor; return (new_text_len <= allowed_student_length); @@ -224,7 +224,7 @@ void KTouchSlideLine::slide() { // *** Protected member functions (event implementation) *** -void KTouchSlideLine::paintEvent(QPaintEvent*) { +void KTouchSlideLine::paintEvent(TQPaintEvent*) { KD_DEBUG( "[KTouchSlideLine::paintEvent]" << endl ); if (m_studentPixmap==NULL || m_teacherPixmap==NULL) updateSlidingLines(); @@ -233,7 +233,7 @@ void KTouchSlideLine::paintEvent(QPaintEvent*) { } // ---------------------------------------------------------------------------- -void KTouchSlideLine::resizeEvent ( QResizeEvent * ) { +void KTouchSlideLine::resizeEvent ( TQResizeEvent * ) { KD_DEBUG( "[KTouchSlideLine::resizeEvent]" << endl ); // required input member variables: none @@ -261,7 +261,7 @@ void KTouchSlideLine::resizeEvent ( QResizeEvent * ) { // *** Private member functions (event implementation) -int KTouchSlideLine::textLen(const QFontMetrics& fontMetrics, const QString& text) { +int KTouchSlideLine::textLen(const TQFontMetrics& fontMetrics, const TQString& text) { //KD_DEBUG( "[KTouchSlideLine::textLen]" << endl; // required input member variables: m_xCharWidth @@ -296,7 +296,7 @@ void KTouchSlideLine::resizeFont() { m_yCursorStudent = height() - m_marginVerWidget - m_slideLineHeight + y_line_margin; KD_DEBUG( " m_yCursorStudent = " << m_yCursorStudent << endl ); // get font infos - QFontMetrics fontMetrics( m_font ); + TQFontMetrics fontMetrics( m_font ); // width of a single x character m_xCharWidth = fontMetrics.boundingRect("x").width(); // width of a single space character @@ -313,13 +313,13 @@ void KTouchSlideLine::drawCursor() { // m_xFrameTeacher, m_xFrameTeacherCurrent, // m_xFrameStudent, m_xFrameStudentCurrent, - QPainter p(this); + TQPainter p(this); #ifdef DRAW_TEACHER_CURSOR - QColor col_tt = Prefs::commonTypingLineColors() ? + TQColor col_tt = Prefs::commonTypingLineColors() ? Prefs::teacherTextColor() : KTouchColorScheme::m_colorSchemes[Prefs::currentColorScheme()].m_teacherTextColor; - QColor col_tb = Prefs::commonTypingLineColors() ? + TQColor col_tb = Prefs::commonTypingLineColors() ? Prefs::teacherBackgroundColor() : KTouchColorScheme::m_colorSchemes[Prefs::currentColorScheme()].m_teacherBackground; @@ -352,7 +352,7 @@ void KTouchSlideLine::drawCursor() { } // ---------------------------------------------------------------------------- -void KTouchSlideLine::drawEnterChar(QPainter *painter, int cursorPos, int y, int enterWidth) { +void KTouchSlideLine::drawEnterChar(TQPainter *painter, int cursorPos, int y, int enterWidth) { // required input member variables: none int gap = std::min(2,static_cast<int>(0.2*enterWidth)); @@ -377,7 +377,7 @@ void KTouchSlideLine::updateSlidingLines() { if (m_slideLineHeight == 0) return; // first update some variables - QFontMetrics fontMetrics( m_font ); + TQFontMetrics fontMetrics( m_font ); m_teacherTextLen = textLen(fontMetrics, m_teacherText); KD_DEBUG( " m_teacherTextLen = " << m_teacherTextLen << endl ); @@ -406,40 +406,40 @@ void KTouchSlideLine::updateSlidingLines() { // create the teacher pixmap int w = 2*m_marginCursor + m_teacherTextLen; // TODO : add size of enter character int h = m_slideLineHeight; - m_teacherPixmap = new QPixmap(w,h); + m_teacherPixmap = new TQPixmap(w,h); KD_DEBUG( " m_teacherPixmap = " << w << " x " << h << endl ); // draw the teacher pixmap text - QPainter painter; + TQPainter painter; painter.begin (m_teacherPixmap, this); painter.setFont( m_font ); - QColor col_tt = Prefs::commonTypingLineColors() ? + TQColor col_tt = Prefs::commonTypingLineColors() ? Prefs::teacherTextColor() : KTouchColorScheme::m_colorSchemes[Prefs::currentColorScheme()].m_teacherTextColor; - QColor col_tb = Prefs::commonTypingLineColors() ? + TQColor col_tb = Prefs::commonTypingLineColors() ? Prefs::teacherBackgroundColor() : KTouchColorScheme::m_colorSchemes[Prefs::currentColorScheme()].m_teacherBackground; - painter.fillRect( m_teacherPixmap->rect(), QBrush(col_tb) ); + painter.fillRect( m_teacherPixmap->rect(), TQBrush(col_tb) ); painter.setPen( col_tt ); // create a rectangle for the text drawing - QRect textRect(m_marginCursor, 0, w-2*m_marginCursor, h); + TQRect textRect(m_marginCursor, 0, w-2*m_marginCursor, h); // left aligned if (!Prefs::right2LeftTyping()) { - painter.drawText(textRect, QPainter::AlignLeft | QPainter::AlignVCenter, m_teacherText); + painter.drawText(textRect, TQPainter::AlignLeft | TQPainter::AlignVCenter, m_teacherText); // TODO : draw enter char after the text } // right aligned, e.g. for Hebrew text else { - painter.drawText(textRect, QPainter::AlignRight | QPainter::AlignVCenter, m_teacherText); + painter.drawText(textRect, TQPainter::AlignRight | TQPainter::AlignVCenter, m_teacherText); // TODO : draw enter character at left of text } painter.end(); // done with the teachers text which will not change so quickly again // create student line pixmap thats slightly longer than the teacher's pixmap - m_studentPixmap = new QPixmap(w+100,h); + m_studentPixmap = new TQPixmap(w+100,h); KD_DEBUG( " m_studentPixmap = " << w+100 << " x " << h << endl ); // update (draw) student line and calculate coordinates needed for sliding @@ -457,7 +457,7 @@ void KTouchSlideLine::updateStudentLine() { if (m_teacherTextLen == 0) return; - QFontMetrics fontMetrics( m_font ); + TQFontMetrics fontMetrics( m_font ); m_studentTextLen = textLen(fontMetrics, m_studentText); KD_DEBUG( " m_studentTextLen = " << m_studentTextLen << endl ); @@ -467,7 +467,7 @@ void KTouchSlideLine::updateStudentLine() { unsigned int min_len = QMIN(teacherLen, studentLen); - QString correctText; + TQString correctText; if (!Prefs::right2LeftTyping()) { // for text typed from left to right for (unsigned int i=0; i<min_len; ++i) { @@ -531,7 +531,7 @@ void KTouchSlideLine::updateStudentLine() { KD_DEBUG( " m_xFrameTeacher = " << m_xFrameStudent << endl ); // now let's draw the students pixmap - QPainter painter; + TQPainter painter; painter.begin (m_studentPixmap, this); if (Prefs::colorOnError()) { // draw the student line depending on the colour settings @@ -549,7 +549,7 @@ void KTouchSlideLine::updateStudentLine() { m_cursorColor = Prefs::commonTypingLineColors() ? Prefs::studentTextColor() : KTouchColorScheme::m_colorSchemes[Prefs::currentColorScheme()].m_studentTextColor; } - painter.fillRect (m_studentPixmap->rect(), QBrush(m_cursorBackground)); + painter.fillRect (m_studentPixmap->rect(), TQBrush(m_cursorBackground)); painter.setPen( m_cursorColor ); } else { @@ -557,15 +557,15 @@ void KTouchSlideLine::updateStudentLine() { m_cursorColor = Prefs::studentTextColor(); painter.setPen( m_cursorColor ); m_cursorBackground = Prefs::studentBackgroundColor(); - painter.fillRect( m_studentPixmap->rect(), QBrush(m_cursorBackground) ); + painter.fillRect( m_studentPixmap->rect(), TQBrush(m_cursorBackground) ); } // draw the text painter.setFont( m_font ); - QRect textRect(m_marginCursor, 0, m_studentPixmap->width()-2*m_marginCursor, m_studentPixmap->height()); + TQRect textRect(m_marginCursor, 0, m_studentPixmap->width()-2*m_marginCursor, m_studentPixmap->height()); if (Prefs::right2LeftTyping()) - painter.drawText(textRect, QPainter::AlignRight | QPainter::AlignVCenter, m_studentText); + painter.drawText(textRect, TQPainter::AlignRight | TQPainter::AlignVCenter, m_studentText); else - painter.drawText(textRect, QPainter::AlignLeft | QPainter::AlignVCenter, m_studentText); + painter.drawText(textRect, TQPainter::AlignLeft | TQPainter::AlignVCenter, m_studentText); painter.end(); // done painting the students line diff --git a/ktouch/src/ktouchslideline.h b/ktouch/src/ktouchslideline.h index bb6f7a1e..a745119d 100644 --- a/ktouch/src/ktouchslideline.h +++ b/ktouch/src/ktouchslideline.h @@ -17,8 +17,8 @@ #include <config.h> #endif -#include <qwidget.h> -#include <qtimer.h> +#include <tqwidget.h> +#include <tqtimer.h> class QPixmap; class QPainter; @@ -31,11 +31,11 @@ class QPainter; /// choice of the background colour) is done by the widget. /// /// Please refer to the documentation 'sliding_line_widget.pdf' in the doc folder. -class KTouchSlideLine : public QWidget { +class KTouchSlideLine : public TQWidget { Q_OBJECT public: /// Constructor - KTouchSlideLine(QWidget *parent); + KTouchSlideLine(TQWidget *parent); /// Destructor, free memory allocated for the line pixmap. ~KTouchSlideLine(); /// Applies the preferences (font and colours). @@ -46,24 +46,24 @@ class KTouchSlideLine : public QWidget { /// Sets the teacher and student text (usually called when a new line is started). /// This function calls updateSlidingLines(). /// @see updateSlidingLines() - void setNewText(const QString& teacher_text, const QString& student_text); + void setNewText(const TQString& teacher_text, const TQString& student_text); /// Sets the student text (called whenever the student string changes). /// This function calls updateStudentLine(). /// @see updateStudentLine() - void setStudentText(const QString& text); + void setStudentText(const TQString& text); /// Changes the font of the slide line widget and updates everything else. /// This function is called when the font is changed. It updates the size /// of the sliding lines and the font size accordingly. Then it updates /// the widget. /// This function calls resizeFont(). /// @see resizeFont() - void setFont(const QFont& font); + void setFont(const TQFont& font); /// Returns true when the character can be added without problems. /// This function checks if the new possibly wrong student line /// would still fit into the student line pixmap and returns /// false if not. - bool canAddCharacter(const QString& new_student_text); + bool canAddCharacter(const TQString& new_student_text); public slots: /// Starts or stops the cursor blinking timer. @@ -80,16 +80,16 @@ class KTouchSlideLine : public QWidget { /// This function calls updateSlidingLines() if necessary, otherwise just slide(). /// @see updateSlidingLines() /// @see slide() - void paintEvent( QPaintEvent * ); + void paintEvent( TQPaintEvent * ); /// Will be called when the widget is resized. /// This event will first recalculate the geometry of the sliding lines. /// Then the font size will be updated and through that, the sliding lines will be /// updated. - void resizeEvent ( QResizeEvent * ); + void resizeEvent ( TQResizeEvent * ); private: /// Calculates the correct text length (in pixels) taking trailing spaces into account - int textLen(const QFontMetrics& fontMetrics, const QString& text); + int textLen(const TQFontMetrics& fontMetrics, const TQString& text); /// Will recalculate the font size and related variables depending on the height of the widget. /// This function calls updateSlidingLines(). /// @see updateSlidingLines() @@ -97,7 +97,7 @@ class KTouchSlideLine : public QWidget { /// Just draws the cursor (if visible) void drawCursor(); /// Draws the "enter" character at the given position (y is the y-position of the arrow). - void drawEnterChar(QPainter *painter, int cursorPos, int y, int enterWidth); + void drawEnterChar(TQPainter *painter, int cursorPos, int y, int enterWidth); /// Recreates the student and teacher pixmaps and updates all related variables. /// In this function the teacher pixmap is drawn it will not be modified until the next /// call of updateSlidingLines(). This function also calls updateStudentLine(). @@ -106,18 +106,18 @@ class KTouchSlideLine : public QWidget { /// Redraws the student line alone and updates all related variables. void updateStudentLine(); - QFont m_font; ///< The font for the sliding lines. - QString m_teacherText; ///< The teachers text. - QString m_studentText; ///< The students text. - QPixmap *m_teacherPixmap; ///< Pixmap used to draw the teacher sliding line, created in updateSlidingLines(). - QPixmap *m_studentPixmap; ///< Pixmap used to draw the student sliding line, created in updateSlidingLines(). + TQFont m_font; ///< The font for the sliding lines. + TQString m_teacherText; ///< The teachers text. + TQString m_studentText; ///< The students text. + TQPixmap *m_teacherPixmap; ///< Pixmap used to draw the teacher sliding line, created in updateSlidingLines(). + TQPixmap *m_studentPixmap; ///< Pixmap used to draw the student sliding line, created in updateSlidingLines(). - QTimer m_slideTimer; ///< This is the timer for the sliding of the lines. + TQTimer m_slideTimer; ///< This is the timer for the sliding of the lines. bool m_cursorVisible; ///< Flag which indicates the current state of the cursor. - QTimer m_cursorTimer; ///< This is the cursor on/off timer. - QColor m_cursorColor; ///< Defines the colour of the cursor (when turned on). - QColor m_cursorBackground; ///< Defines the background colour of the cursor (when turned off). + TQTimer m_cursorTimer; ///< This is the cursor on/off timer. + TQColor m_cursorColor; ///< Defines the colour of the cursor (when turned on). + TQColor m_cursorBackground; ///< Defines the background colour of the cursor (when turned off). // variables depending on size of widget, will be updated in resizeEvent() int m_marginVerWidget; ///< Vertical margin between widget boundary and sliding line in pixels. diff --git a/ktouch/src/ktouchstatistics.cpp b/ktouch/src/ktouchstatistics.cpp index 97b1d45c..dbd807a6 100644 --- a/ktouch/src/ktouchstatistics.cpp +++ b/ktouch/src/ktouchstatistics.cpp @@ -17,11 +17,11 @@ #include <vector> #include <utility> -#include <qprogressbar.h> -#include <qlcdnumber.h> -#include <qlabel.h> -#include <qradiobutton.h> -#include <qbuttongroup.h> +#include <tqprogressbar.h> +#include <tqlcdnumber.h> +#include <tqlabel.h> +#include <tqradiobutton.h> +#include <tqbuttongroup.h> #include <kpushbutton.h> #include <kcombobox.h> @@ -34,19 +34,19 @@ #include "ktouch.h" #include "ktouchchartwidget.h" -KTouchStatistics::KTouchStatistics(QWidget* parent) +KTouchStatistics::KTouchStatistics(TQWidget* parent) : KTouchStatisticsDlg(parent) { sessionsRadio->setChecked(true); WPMRadio->setChecked(true); eventRadio->setChecked(true); - connect(closeButton, SIGNAL(clicked()), this, SLOT(accept()) ); - connect(lectureCombo, SIGNAL(activated(int)), this, SLOT(lectureActivated(int)) ); - connect(clearButton, SIGNAL(clicked()), this, SLOT(clearHistory()) ); + connect(closeButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(accept()) ); + connect(lectureCombo, TQT_SIGNAL(activated(int)), this, TQT_SLOT(lectureActivated(int)) ); + connect(clearButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(clearHistory()) ); // connect the radio buttons with the chart update function - connect(buttonGroup1, SIGNAL(clicked(int)), this, SLOT(updateChartTab()) ); - connect(buttonGroup2, SIGNAL(clicked(int)), this, SLOT(updateChartTab()) ); - connect(buttonGroup3, SIGNAL(clicked(int)), this, SLOT(updateChartTab()) ); + connect(buttonGroup1, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(updateChartTab()) ); + connect(buttonGroup2, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(updateChartTab()) ); + connect(buttonGroup3, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(updateChartTab()) ); // TODO : temporarily remove detailed stats page and deactivate options levelsRadio->setEnabled(false); @@ -63,10 +63,10 @@ void KTouchStatistics::run(const KURL& currentLecture, const KTouchStatisticsDat // fill lecture combo with data // loop over all lecturestatistics lectureCombo->clear(); - QMapConstIterator<KURL, KTouchLectureStats> it = stats.m_lectureStats.begin(); + TQMapConstIterator<KURL, KTouchLectureStats> it = stats.m_lectureStats.begin(); m_currentIndex = 0; while (it != stats.m_lectureStats.end()) { - QString t = it.data().m_lectureTitle; + TQString t = it.data().m_lectureTitle; // if current lecture, remember index and adjust text if (it.key() == currentLecture || currentLecture.isEmpty() && it.key().url()=="default") @@ -122,13 +122,13 @@ void KTouchStatistics::lectureActivated(int index) { // ---------------------------------------------------------------------------- void KTouchStatistics::clearHistory() { - if (KMessageBox::warningContinueCancel(this, i18n("Erase all statistics data for the current user?"),QString::null,KStdGuiItem::del()) + if (KMessageBox::warningContinueCancel(this, i18n("Erase all statistics data for the current user?"),TQString::null,KStdGuiItem::del()) == KMessageBox::Continue) { KTouchPtr->clearStatistics(); // clear statistics data in KTouch // clear and reset local copy m_allStats.clear(); - QString s = lectureCombo->text(m_currentIndex); + TQString s = lectureCombo->text(m_currentIndex); lectureCombo->clear(); lectureCombo->insertItem(s); m_currentIndex = 0; @@ -142,7 +142,7 @@ void KTouchStatistics::clearHistory() { void KTouchStatistics::updateCurrentSessionTab() { // session/level/info - QString levelnums; + TQString levelnums; int last_level = -2; int levels_count = 0; std::set<unsigned int>::iterator last_it = m_currSessionStats.m_levelNums.end(); @@ -161,7 +161,7 @@ void KTouchStatistics::updateCurrentSessionTab() { else levelnums += ","; } levels_count = 0; - levelnums += QString("%1").arg(*it+1); + levelnums += TQString("%1").arg(*it+1); } else { @@ -233,7 +233,7 @@ void KTouchStatistics::updateCurrentSessionTab() { void KTouchStatistics::updateCurrentLevelTab() { // level info - levelLabel2->setText( QString("%1").arg(m_currLevelStats.m_levelNum+1) ); + levelLabel2->setText( TQString("%1").arg(m_currLevelStats.m_levelNum+1) ); // general stats group elapsedTimeLCDLevel->display(static_cast<int>(m_currLevelStats.m_elapsedTime)); totalCharsLCDLevel->display(static_cast<int>(m_currLevelStats.m_totalChars) ); @@ -306,15 +306,15 @@ void KTouchStatistics::updateChartTab() { } else { // find correct lecture index - QMapConstIterator<KURL, KTouchLectureStats> it = m_allStats.m_lectureStats.begin(); + TQMapConstIterator<KURL, KTouchLectureStats> it = m_allStats.m_lectureStats.begin(); int index = m_lectureIndex; while (index-- > 0) ++it; std::vector< std::pair<double, double> > data; - QString caption = "Session data"; + TQString caption = "Session data"; switch (buttonGroup2->selectedId()) { case 0 : // words per minute // loop over all session data entries in *it and store words per minute data - for (QValueVector<KTouchSessionStats>::const_iterator session_it = (*it).m_sessionStats.begin(); + for (TQValueVector<KTouchSessionStats>::const_iterator session_it = (*it).m_sessionStats.begin(); session_it != (*it).m_sessionStats.end(); ++session_it) { double t = (*session_it).m_elapsedTime; @@ -328,7 +328,7 @@ void KTouchStatistics::updateChartTab() { { double t = m_currSessionStats.m_elapsedTime; double wpm = m_currSessionStats.m_words/t*60.0; - double tp = QDateTime::currentDateTime().toTime_t()/(3600.0*24); + double tp = TQDateTime::currentDateTime().toTime_t()/(3600.0*24); data.push_back(std::make_pair(tp, wpm) ); } chartWidget->LeftAxis.setLabel( i18n("Words per minute") ); @@ -338,7 +338,7 @@ void KTouchStatistics::updateChartTab() { case 1 : // chars per minute // loop over all session data entries in *it and store chars per minute data - for (QValueVector<KTouchSessionStats>::const_iterator session_it = (*it).m_sessionStats.begin(); + for (TQValueVector<KTouchSessionStats>::const_iterator session_it = (*it).m_sessionStats.begin(); session_it != (*it).m_sessionStats.end(); ++session_it) { double t = (*session_it).m_elapsedTime; @@ -352,7 +352,7 @@ void KTouchStatistics::updateChartTab() { { double t = m_currSessionStats.m_elapsedTime; double cpm = m_currSessionStats.m_correctChars/t*60.0; - double tp = QDateTime::currentDateTime().toTime_t()/(3600.0*24); + double tp = TQDateTime::currentDateTime().toTime_t()/(3600.0*24); data.push_back(std::make_pair(tp, cpm) ); } chartWidget->LeftAxis.setLabel( i18n("Characters per minute") ); @@ -362,7 +362,7 @@ void KTouchStatistics::updateChartTab() { case 2 : // correctness // loop over all session data entries in *it and store correctness data - for (QValueVector<KTouchSessionStats>::const_iterator session_it = (*it).m_sessionStats.begin(); + for (TQValueVector<KTouchSessionStats>::const_iterator session_it = (*it).m_sessionStats.begin(); session_it != (*it).m_sessionStats.end(); ++session_it) { double tc = (*session_it).m_totalChars; @@ -376,7 +376,7 @@ void KTouchStatistics::updateChartTab() { { double tc = m_currSessionStats.m_totalChars; double corr = m_currSessionStats.m_correctChars/tc; - double tp = QDateTime::currentDateTime().toTime_t()/(3600.0*24); + double tp = TQDateTime::currentDateTime().toTime_t()/(3600.0*24); data.push_back(std::make_pair(tp, corr) ); } chartWidget->LeftAxis.setLabel( i18n("Correctness") ); @@ -386,7 +386,7 @@ void KTouchStatistics::updateChartTab() { case 3 : // skill // loop over all session data entries in *it and store correctness data - for (QValueVector<KTouchSessionStats>::const_iterator session_it = (*it).m_sessionStats.begin(); + for (TQValueVector<KTouchSessionStats>::const_iterator session_it = (*it).m_sessionStats.begin(); session_it != (*it).m_sessionStats.end(); ++session_it) { double tc = (*session_it).m_totalChars; @@ -407,7 +407,7 @@ void KTouchStatistics::updateChartTab() { double t = m_currSessionStats.m_elapsedTime; double cpm = m_currSessionStats.m_correctChars/t*60.0; double skill = corr*cpm; - double tp = QDateTime::currentDateTime().toTime_t()/(3600.0*24); + double tp = TQDateTime::currentDateTime().toTime_t()/(3600.0*24); data.push_back(std::make_pair(tp, skill) ); } chartWidget->LeftAxis.setLabel( i18n("Skill") ); diff --git a/ktouch/src/ktouchstatistics.h b/ktouch/src/ktouchstatistics.h index 549dfc3c..8fa75c96 100644 --- a/ktouch/src/ktouchstatistics.h +++ b/ktouch/src/ktouchstatistics.h @@ -29,7 +29,7 @@ class KTouchStatistics : public KTouchStatisticsDlg { Q_OBJECT public: /// Constructor, takes a pointer to the trainer object. - KTouchStatistics(QWidget* parent); + KTouchStatistics(TQWidget* parent); /// Fills the statistics dialog with data and executes it. void run(const KURL& currentLecture, const KTouchStatisticsData& stats, diff --git a/ktouch/src/ktouchstatisticsdata.cpp b/ktouch/src/ktouchstatisticsdata.cpp index 42251df2..08fdff35 100644 --- a/ktouch/src/ktouchstatisticsdata.cpp +++ b/ktouch/src/ktouchstatisticsdata.cpp @@ -13,9 +13,9 @@ #include "config.h" #include "ktouchstatisticsdata.h" -#include <qfile.h> -#include <qstringlist.h> -#include <qdom.h> +#include <tqfile.h> +#include <tqstringlist.h> +#include <tqdom.h> #include <kdebug.h> #include <klocale.h> @@ -40,7 +40,7 @@ int KTouchCharStats::missHitRatio() const { } // ---------------------------------------------------------------------------- -QTextStream& operator<<(QTextStream &out, const KTouchCharStats &ch) { +TQTextStream& operator<<(TQTextStream &out, const KTouchCharStats &ch) { return (out << ch.m_char.unicode() << " " << ch.m_correctCount << " " << ch.m_wrongCount); } // ---------------------------------------------------------------------------- @@ -59,9 +59,9 @@ void KTouchLevelStats::clear() { } // ---------------------------------------------------------------------------- -bool KTouchLevelStats::read(QDomNode in) { +bool KTouchLevelStats::read(TQDomNode in) { // read the level number - QDomNode n = in.attributes().namedItem("Number"); + TQDomNode n = in.attributes().namedItem("Number"); bool ok; if (!n.isNull()) { m_levelNum = n.nodeValue().toInt(&ok); @@ -97,14 +97,14 @@ bool KTouchLevelStats::read(QDomNode in) { // done with attributes, read recording time n = in.namedItem("Time"); if (!n.isNull()) { - QString timestring = n.firstChild().nodeValue(); - if (timestring != QString::null) - m_timeRecorded = QDateTime::fromString(timestring, Qt::ISODate); + TQString timestring = n.firstChild().nodeValue(); + if (timestring != TQString::null) + m_timeRecorded = TQDateTime::fromString(timestring, Qt::ISODate); } // read characters n = in.namedItem("CharStats"); if (!n.isNull()) { - QString char_data = n.firstChild().nodeValue(); + TQString char_data = n.firstChild().nodeValue(); //kdDebug() << "'" << char_data << "'" << endl; #ifdef HAVE_SSTREAM std::stringstream strm(std::string(char_data.local8Bit())); @@ -113,15 +113,15 @@ bool KTouchLevelStats::read(QDomNode in) { #endif int ch, correct, wrong; while (strm >> ch >> correct >> wrong) - m_charStats.insert( KTouchCharStats(QChar(ch), correct, wrong) ); + m_charStats.insert( KTouchCharStats(TQChar(ch), correct, wrong) ); //kdDebug() << m_charStats.size() << endl; } return true; } // ---------------------------------------------------------------------------- -void KTouchLevelStats::write(QDomDocument& doc, QDomElement& root) const { - QDomElement level = doc.createElement("LevelStats"); +void KTouchLevelStats::write(TQDomDocument& doc, TQDomElement& root) const { + TQDomElement level = doc.createElement("LevelStats"); root.appendChild(level); level.setAttribute("Number", m_levelNum); level.setAttribute("Time", m_elapsedTime); @@ -129,15 +129,15 @@ void KTouchLevelStats::write(QDomDocument& doc, QDomElement& root) const { level.setAttribute("Corrects", m_correctChars); level.setAttribute("Words", m_words); // add time - QDomElement e = doc.createElement("Time"); - QDomText tn = doc.createTextNode(m_timeRecorded.toString(Qt::ISODate)); + TQDomElement e = doc.createElement("Time"); + TQDomText tn = doc.createTextNode(m_timeRecorded.toString(Qt::ISODate)); e.appendChild(tn); level.appendChild(e); // add char stats - QString char_data; + TQString char_data; // we append for each missed char the char-unicode and the counters for (std::set<KTouchCharStats>::const_iterator it=m_charStats.begin(); it!=m_charStats.end(); ++it) - char_data += QString(" %1 %2 %3").arg(it->m_char.unicode()) + char_data += TQString(" %1 %2 %3").arg(it->m_char.unicode()) .arg(it->m_correctCount).arg(it->m_wrongCount); e = doc.createElement("CharStats"); tn = doc.createTextNode(char_data); @@ -146,11 +146,11 @@ void KTouchLevelStats::write(QDomDocument& doc, QDomElement& root) const { } // ---------------------------------------------------------------------------- -void KTouchLevelStats::addCorrectChar(QChar key) { +void KTouchLevelStats::addCorrectChar(TQChar key) { ++m_correctChars; ++m_totalChars; // we only count non-space characters - if (key!=QChar(' ')) { + if (key!=TQChar(' ')) { std::set<KTouchCharStats>::iterator it = m_charStats.find( KTouchCharStats(key,0,0) ); if (it==m_charStats.end()) m_charStats.insert( KTouchCharStats(key,1,0) ); @@ -169,9 +169,9 @@ void KTouchLevelStats::removeCorrectChar() { } // ---------------------------------------------------------------------------- -void KTouchLevelStats::addWrongChar(QChar key) { +void KTouchLevelStats::addWrongChar(TQChar key) { ++m_totalChars; - if (key==QChar(8) || key==QChar(' ')) + if (key==TQChar(8) || key==TQChar(' ')) return; // don't remember wrong backspaces or spaces std::set<KTouchCharStats>::iterator it = m_charStats.find( KTouchCharStats(key,0,0) ); if (it==m_charStats.end()) @@ -214,9 +214,9 @@ void KTouchSessionStats::clear() { } // ---------------------------------------------------------------------------- -bool KTouchSessionStats::read(QDomNode in) { +bool KTouchSessionStats::read(TQDomNode in) { // read time - QDomNode n = in.attributes().namedItem("Time"); + TQDomNode n = in.attributes().namedItem("Time"); bool ok; if (!n.isNull()) { m_elapsedTime = n.nodeValue().toDouble(&ok); @@ -243,14 +243,14 @@ bool KTouchSessionStats::read(QDomNode in) { // done with attributes, read recording time n = in.namedItem("Time"); if (!n.isNull()) { - QString timestring = n.firstChild().nodeValue(); - if (timestring != QString::null) - m_timeRecorded = QDateTime::fromString(timestring, Qt::ISODate); + TQString timestring = n.firstChild().nodeValue(); + if (timestring != TQString::null) + m_timeRecorded = TQDateTime::fromString(timestring, Qt::ISODate); } // read level numbers n = in.namedItem("LevelNums"); if (!n.isNull()) { - QString str = n.firstChild().nodeValue(); + TQString str = n.firstChild().nodeValue(); #ifdef HAVE_SSTREAM std::stringstream strm(std::string(str.local8Bit())); #else @@ -263,7 +263,7 @@ bool KTouchSessionStats::read(QDomNode in) { // read characters n = in.namedItem("CharStats"); if (!n.isNull()) { - QString char_data = n.firstChild().nodeValue(); + TQString char_data = n.firstChild().nodeValue(); //kdDebug() << "'" << char_data << "'" << endl; #ifdef HAVE_SSTREAM std::stringstream strm(std::string(char_data.local8Bit())); @@ -272,7 +272,7 @@ bool KTouchSessionStats::read(QDomNode in) { #endif int ch, correct, wrong; while (strm >> ch >> correct >> wrong) - m_charStats.insert( KTouchCharStats(QChar(ch), correct, wrong) ); + m_charStats.insert( KTouchCharStats(TQChar(ch), correct, wrong) ); //kdDebug() << m_charStats.size() << endl; } @@ -280,31 +280,31 @@ bool KTouchSessionStats::read(QDomNode in) { } // ---------------------------------------------------------------------------- -void KTouchSessionStats::write(QDomDocument& doc, QDomElement& root) const { - QDomElement session = doc.createElement("SessionStats"); +void KTouchSessionStats::write(TQDomDocument& doc, TQDomElement& root) const { + TQDomElement session = doc.createElement("SessionStats"); root.appendChild(session); session.setAttribute("Time", m_elapsedTime); session.setAttribute("Chars", m_totalChars); session.setAttribute("Corrects", m_correctChars); session.setAttribute("Words", m_words); // add time - QDomElement e = doc.createElement("Time"); - QDomText tn = doc.createTextNode(m_timeRecorded.toString(Qt::ISODate)); + TQDomElement e = doc.createElement("Time"); + TQDomText tn = doc.createTextNode(m_timeRecorded.toString(Qt::ISODate)); e.appendChild(tn); session.appendChild(e); // add levels - QString level_nums; + TQString level_nums; for (std::set<unsigned int>::const_iterator it = m_levelNums.begin(); it != m_levelNums.end(); ++it) - level_nums += QString( " %1").arg(*it); + level_nums += TQString( " %1").arg(*it); e = doc.createElement("LevelNums"); tn = doc.createTextNode(level_nums); e.appendChild(tn); session.appendChild(e); // add char data - QString char_data; + TQString char_data; // we append for each missed char the char-unicode and the counters for (std::set<KTouchCharStats>::const_iterator it=m_charStats.begin(); it!=m_charStats.end(); ++it) - char_data += QString(" %1 %2 %3").arg(it->m_char.unicode()) + char_data += TQString(" %1 %2 %3").arg(it->m_char.unicode()) .arg(it->m_correctCount).arg(it->m_wrongCount); e = doc.createElement("CharStats"); tn = doc.createTextNode(char_data); @@ -313,11 +313,11 @@ void KTouchSessionStats::write(QDomDocument& doc, QDomElement& root) const { } // ---------------------------------------------------------------------------- -void KTouchSessionStats::addCorrectChar(QChar key) { +void KTouchSessionStats::addCorrectChar(TQChar key) { ++m_correctChars; ++m_totalChars; // we only count non-space characters - if (key!=QChar(' ')) { + if (key!=TQChar(' ')) { std::set<KTouchCharStats>::iterator it = m_charStats.find( KTouchCharStats(key,0,0) ); if (it==m_charStats.end()) m_charStats.insert( KTouchCharStats(key,1,0) ); @@ -336,9 +336,9 @@ void KTouchSessionStats::removeCorrectChar() { } // ---------------------------------------------------------------------------- -void KTouchSessionStats::addWrongChar(QChar key) { +void KTouchSessionStats::addWrongChar(TQChar key) { ++m_totalChars; - if (key==QChar(8) || key==QChar(' ')) + if (key==TQChar(8) || key==TQChar(' ')) return; // don't remember wrong backspaces or spaces std::set<KTouchCharStats>::iterator it = m_charStats.find( KTouchCharStats(key,0,0) ); if (it==m_charStats.end()) @@ -357,17 +357,17 @@ void KTouchSessionStats::addWrongChar(QChar key) { // *** KTouchLectureStats *** void KTouchLectureStats::clear() { - m_lectureTitle = QString::null; - m_lectureURL = QString::null; + m_lectureTitle = TQString::null; + m_lectureURL = TQString::null; m_levelStats.clear(); m_sessionStats.clear(); } // ---------------------------------------------------------------------------- -bool KTouchLectureStats::read(QDomNode in) { +bool KTouchLectureStats::read(TQDomNode in) { clear(); // read the URL - QDomNode n = in.namedItem("URL"); + TQDomNode n = in.namedItem("URL"); if (!n.isNull()) m_lectureURL = n.firstChild().nodeValue(); else return false; // no URL, statistics useless // read the Title @@ -377,7 +377,7 @@ bool KTouchLectureStats::read(QDomNode in) { n = in.namedItem("AllLevelStats"); if (!n.isNull()) { // loop over all childs and read levels - QDomNode levelNode = n.firstChild(); + TQDomNode levelNode = n.firstChild(); while (!levelNode.isNull()) { //kdDebug() << "[KTouchLectureStats::read] Reading level stats" << endl; KTouchLevelStats tmp; @@ -389,7 +389,7 @@ bool KTouchLectureStats::read(QDomNode in) { n = in.namedItem("AllSessionStats"); if (!n.isNull()) { // loop over all childs and read sessions - QDomNode sessionNode = n.firstChild(); + TQDomNode sessionNode = n.firstChild(); while (!sessionNode.isNull()) { //kdDebug() << "[KTouchLectureStats::read] Reading session stats" << endl; KTouchSessionStats tmp; @@ -401,35 +401,35 @@ bool KTouchLectureStats::read(QDomNode in) { } // ---------------------------------------------------------------------------- -void KTouchLectureStats::write(QDomDocument& doc, QDomElement& root) const { +void KTouchLectureStats::write(TQDomDocument& doc, TQDomElement& root) const { if (m_lectureURL.isEmpty()) return; // Error here! - QDomElement lecture = doc.createElement("LectureStats"); + TQDomElement lecture = doc.createElement("LectureStats"); root.appendChild(lecture); // store lecture URL - QDomElement urlElement = doc.createElement("URL"); - QDomText urlText = doc.createTextNode(m_lectureURL.url()); + TQDomElement urlElement = doc.createElement("URL"); + TQDomText urlText = doc.createTextNode(m_lectureURL.url()); urlElement.appendChild(urlText); lecture.appendChild(urlElement); // store title - QString title = m_lectureTitle; + TQString title = m_lectureTitle; if (title.isEmpty()) title = m_lectureURL.fileName(); - QDomElement titleElement = doc.createElement("Title"); - QDomText titleText = doc.createTextNode(title); + TQDomElement titleElement = doc.createElement("Title"); + TQDomText titleText = doc.createTextNode(title); titleElement.appendChild(titleText); lecture.appendChild(titleElement); // store level stats - QDomElement levelStatsElement = doc.createElement("AllLevelStats"); + TQDomElement levelStatsElement = doc.createElement("AllLevelStats"); lecture.appendChild(levelStatsElement); - for (QValueVector<KTouchLevelStats>::ConstIterator it = m_levelStats.begin(); + for (TQValueVector<KTouchLevelStats>::ConstIterator it = m_levelStats.begin(); it != m_levelStats.end(); ++it) { it->write(doc, levelStatsElement); } // store session stats - QDomElement sessionStatsElement = doc.createElement("AllSessionStats"); + TQDomElement sessionStatsElement = doc.createElement("AllSessionStats"); lecture.appendChild(sessionStatsElement); - for (QValueVector<KTouchSessionStats>::ConstIterator it = m_sessionStats.begin(); + for (TQValueVector<KTouchSessionStats>::ConstIterator it = m_sessionStats.begin(); it != m_sessionStats.end(); ++it) { it->write(doc, sessionStatsElement); @@ -446,23 +446,23 @@ void KTouchStatisticsData::clear() { } // ---------------------------------------------------------------------------- -bool KTouchStatisticsData::read(QWidget * window, const KURL& url) { +bool KTouchStatisticsData::read(TQWidget * window, const KURL& url) { if (url.isEmpty()) return false; // Ok, first download the contents as usual using the KIO lib // File is only downloaded if not local, otherwise it's just opened - QString target; + TQString target; bool result = false; if (KIO::NetAccess::download(url, target, window)) { // Ok, that was successful, store the lectureURL and read the file - QFile infile(target); + TQFile infile(target); if ( !infile.open( IO_ReadOnly ) ) { KIO::NetAccess::removeTempFile(target); return false; // Bugger it... couldn't open it... } - QDomDocument doc; + TQDomDocument doc; #ifdef COMPRESSED_XML_STATISTICS - QByteArray array; + TQByteArray array; array = infile.readAll(); array = qUncompress(array); doc.setContent( array ); @@ -476,13 +476,13 @@ bool KTouchStatisticsData::read(QWidget * window, const KURL& url) { } // ---------------------------------------------------------------------------- -bool KTouchStatisticsData::write(QWidget * window, const KURL& url) const { +bool KTouchStatisticsData::write(TQWidget * window, const KURL& url) const { // create the XML document - QDomDocument doc; + TQDomDocument doc; writeStats(doc); // and save it - QString tmpFile; + TQString tmpFile; KTempFile *temp=0; if (url.isLocalFile()) tmpFile=url.path(); // for local files the path is sufficient @@ -492,7 +492,7 @@ bool KTouchStatisticsData::write(QWidget * window, const KURL& url) const { tmpFile=temp->name(); } - QFile outfile(tmpFile); + TQFile outfile(tmpFile); if ( !outfile.open( IO_WriteOnly ) ) { if (temp) delete temp; // kdDebug() << "Error creating lecture file!" << endl; @@ -500,13 +500,13 @@ bool KTouchStatisticsData::write(QWidget * window, const KURL& url) const { } #ifdef COMPRESSED_XML_STATISTICS - QByteArray array; - QTextStream out(array, IO_WriteOnly); + TQByteArray array; + TQTextStream out(array, IO_WriteOnly); out << doc.toString(); array = qCompress(array); outfile.writeBlock(array); #else - QTextStream out( &outfile ); + TQTextStream out( &outfile ); out << doc.toString(); #endif // COMPRESSED_XML_STATISTICS outfile.close(); @@ -520,10 +520,10 @@ bool KTouchStatisticsData::write(QWidget * window, const KURL& url) const { } // ---------------------------------------------------------------------------- -bool KTouchStatisticsData::readStats(QDomDocument& doc) { +bool KTouchStatisticsData::readStats(TQDomDocument& doc) { clear(); // clear current data // retrieve the KTouchStatistics statistics - QDomNodeList entries = doc.elementsByTagName("LectureStats"); + TQDomNodeList entries = doc.elementsByTagName("LectureStats"); bool result = true; unsigned int i=0; while (result && i < entries.count()) { @@ -539,8 +539,8 @@ bool KTouchStatisticsData::readStats(QDomDocument& doc) { } // ---------------------------------------------------------------------------- -void KTouchStatisticsData::writeStats(QDomDocument& doc) const { - QDomElement root = doc.createElement( "KTouchStatistics" ); +void KTouchStatisticsData::writeStats(TQDomDocument& doc) const { + TQDomElement root = doc.createElement( "KTouchStatistics" ); doc.appendChild(root); // Store Lecture statistics LectureStatsMap::ConstIterator it = m_lectureStats.begin(); diff --git a/ktouch/src/ktouchstatisticsdata.h b/ktouch/src/ktouchstatisticsdata.h index 9d3dae0b..c7655aca 100644 --- a/ktouch/src/ktouchstatisticsdata.h +++ b/ktouch/src/ktouchstatisticsdata.h @@ -17,11 +17,11 @@ #include <config.h> #endif -#include <qstring.h> -#include <qvaluevector.h> -#include <qmap.h> -#include <qdom.h> -#include <qdatetime.h> +#include <tqstring.h> +#include <tqvaluevector.h> +#include <tqmap.h> +#include <tqdom.h> +#include <tqdatetime.h> #include <kurl.h> @@ -47,17 +47,17 @@ class KTouchCharStats { /// Default constructor. KTouchCharStats() : m_char(0), m_correctCount(0), m_wrongCount(0) {} /// Constructor with parameters. - KTouchCharStats(QChar ch, unsigned int correct, unsigned int wrong) + KTouchCharStats(TQChar ch, unsigned int correct, unsigned int wrong) : m_char(ch), m_correctCount(correct), m_wrongCount(wrong) {} /// Reads the character statistics from a XML Dom Node. /// @return Returns 'true', when reading was successful or 'false' otherwise. - bool read(QDomNode in); + bool read(TQDomNode in); /// Writes the character statistics to the XML document. - void write(QDomDocument& doc, QDomElement& root) const; + void write(TQDomDocument& doc, TQDomElement& root) const; /// Returns the miss-hit ratio (a value between 0-all correct and 100-all wrong). int missHitRatio() const; - QChar m_char; ///< The character for which statistics are kept. + TQChar m_char; ///< The character for which statistics are kept. unsigned int m_correctCount; ///< How often the character has been typed correctly. unsigned int m_wrongCount; ///< How often the character has been missed (not typed when it ought to be typed). }; @@ -73,7 +73,7 @@ inline bool operator>(const KTouchCharStats &lhs, const KTouchCharStats &rhs) { /// Comparison operator == : returns 'true' when the char-code of 'lhs' is equal to then the one of 'rhs' inline bool operator==(const KTouchCharStats &lhs, const KTouchCharStats &rhs) { return lhs.m_char==rhs.m_char; } /// Writes the content of a KTouchCharStats object into the text stream. -QTextStream& operator<<(QTextStream &out, const KTouchCharStats &ch); +TQTextStream& operator<<(TQTextStream &out, const KTouchCharStats &ch); // *** KTouchLevelStats *** @@ -91,15 +91,15 @@ class KTouchLevelStats { /// Reads the level statistics from a XML Dom Node. /// @return Returns 'true', when reading was successful or 'false' otherwise. - bool read(QDomNode in); + bool read(TQDomNode in); /// Writes the level statistics to the XML document. - void write(QDomDocument& doc, QDomElement& root) const; + void write(TQDomDocument& doc, TQDomElement& root) const; /// Adds a correct character count to the current statistics - void addCorrectChar(QChar key); + void addCorrectChar(TQChar key); /// Removes correct character count void removeCorrectChar(); /// Adds a wrong character count to the current statistics - void addWrongChar(QChar key); + void addWrongChar(TQChar key); /// Returns the typing accuracy or "correctness" as value between 0 and 1. double correctness() const; /// Returns the average typing speed in chars per minute. @@ -132,15 +132,15 @@ class KTouchSessionStats { /// Reads the session statistics from a XML Dom Node. /// @return Returns 'true', when reading was successful or 'false' otherwise. - bool read(QDomNode in); + bool read(TQDomNode in); /// Writes the session statistics to the XML document. - void write(QDomDocument& doc, QDomElement& root) const; + void write(TQDomDocument& doc, TQDomElement& root) const; /// Adds a correct character count to the current statistics - void addCorrectChar(QChar key); + void addCorrectChar(TQChar key); /// Removes a correct character count void removeCorrectChar(); /// Adds a wrong character count to the current statistics - void addWrongChar(QChar key); + void addWrongChar(TQChar key); std::set<unsigned int> m_levelNums; ///< Numbers of the levels in this session. std::set<KTouchCharStats> m_charStats; ///< Holds the statistics for mistyped characters. @@ -167,15 +167,15 @@ class KTouchLectureStats { /// Reads a lecture statistics from a XML Dom Node. /// @return Returns 'true', when reading was successful or 'false' otherwise. - bool read(QDomNode in); + bool read(TQDomNode in); /// Writes the lecture statistics to the XML document. - void write(QDomDocument& doc, QDomElement& root) const; + void write(TQDomDocument& doc, TQDomElement& root) const; QString m_lectureTitle; ///< The descriptive title of the lecture. KURL m_lectureURL; ///< The descriptive title of the lecture. - QValueVector<KTouchLevelStats> m_levelStats; ///< The statistics for all levels in this lecture. - QValueVector<KTouchSessionStats> m_sessionStats; ///< The statistics for all session for in this lecture. + TQValueVector<KTouchLevelStats> m_levelStats; ///< The statistics for all levels in this lecture. + TQValueVector<KTouchSessionStats> m_sessionStats; ///< The statistics for all session for in this lecture. }; @@ -189,7 +189,7 @@ class KTouchLectureStats { /// session statistics is obtained by and stored in the KTouchTrainer object. class KTouchStatisticsData { public: - typedef QMap<KURL, KTouchLectureStats> LectureStatsMap; + typedef TQMap<KURL, KTouchLectureStats> LectureStatsMap; /// Default constructor KTouchStatisticsData() {} @@ -198,17 +198,17 @@ class KTouchStatisticsData { /// Reads the complete statistics from a XML file /// @return Returns 'true', when reading was successful or 'false' otherwise. - bool read(QWidget * window, const KURL& url); + bool read(TQWidget * window, const KURL& url); /// Writes the statistics data to the XML document. - bool write(QWidget * window, const KURL& url) const; + bool write(TQWidget * window, const KURL& url) const; LectureStatsMap m_lectureStats; ///< All statistics of all lectures, stored based on their URLs. private: /// Reads the statistics data from file into an XML document - bool readStats(QDomDocument& doc); + bool readStats(TQDomDocument& doc); /// Saves the statistics data in the XML document - void writeStats(QDomDocument& doc) const; + void writeStats(TQDomDocument& doc) const; }; #endif // KTOUCHSTATISTICSDATA_H diff --git a/ktouch/src/ktouchstatus.cpp b/ktouch/src/ktouchstatus.cpp index 2c0d8341..94d11894 100644 --- a/ktouch/src/ktouchstatus.cpp +++ b/ktouch/src/ktouchstatus.cpp @@ -13,14 +13,14 @@ #include "ktouchstatus.h" #include "ktouchstatus.moc" -#include <qlcdnumber.h> -#include <qlabel.h> -#include <qprogressbar.h> +#include <tqlcdnumber.h> +#include <tqlabel.h> +#include <tqprogressbar.h> #include <kdebug.h> #include <kpushbutton.h> #include "prefs.h" -KTouchStatus::KTouchStatus(QWidget *parent) +KTouchStatus::KTouchStatus(TQWidget *parent) : KTouchStatusLayout(parent) { applyPreferences(); @@ -37,7 +37,7 @@ void KTouchStatus::applyPreferences() { } } -void KTouchStatus::setNewChars(const QString& newChars) { +void KTouchStatus::setNewChars(const TQString& newChars) { newCharsLabel->setText(newChars); } diff --git a/ktouch/src/ktouchstatus.h b/ktouch/src/ktouchstatus.h index 1782d3aa..72bb6acc 100644 --- a/ktouch/src/ktouchstatus.h +++ b/ktouch/src/ktouchstatus.h @@ -29,11 +29,11 @@ class KTouchStatus : public KTouchStatusLayout { Q_OBJECT public: /// Constructor - KTouchStatus(QWidget *parent); + KTouchStatus(TQWidget *parent); /// Called when the preferences have changed in the configuration dialog. void applyPreferences(); /// Sets the new characters text. - void setNewChars(const QString& newChars); + void setNewChars(const TQString& newChars); /// Updates the level LCD and the correctness progress bar void updateStatus(unsigned int level, double correctness); }; diff --git a/ktouch/src/ktouchtrainer.cpp b/ktouch/src/ktouchtrainer.cpp index 81c9da9e..7ed140ca 100644 --- a/ktouch/src/ktouchtrainer.cpp +++ b/ktouch/src/ktouchtrainer.cpp @@ -13,15 +13,15 @@ #include "ktouchtrainer.h" #include "ktouchtrainer.moc" -#include <qlcdnumber.h> -#include <qfile.h> +#include <tqlcdnumber.h> +#include <tqfile.h> #include <kdebug.h> #include <kpushbutton.h> #include <klocale.h> #include <kstandarddirs.h> #include <kaudioplayer.h> -#include <qmessagebox.h> +#include <tqmessagebox.h> #include "ktouch.h" #include "ktouchstatus.h" @@ -32,8 +32,8 @@ #include "prefs.h" KTouchTrainer::KTouchTrainer(KTouchStatus *status, KTouchSlideLine *slideLine, KTouchKeyboardWidget *keyboard, KTouchLecture *lecture) - : QObject(), - m_trainingTimer(new QTimer), + : TQObject(), + m_trainingTimer(new TQTimer), m_statusWidget(status), m_slideLineWidget(slideLine), m_keyboardWidget(keyboard), @@ -55,9 +55,9 @@ KTouchTrainer::KTouchTrainer(KTouchStatus *status, KTouchSlideLine *slideLine, K m_levelDownSound = KGlobal::dirs()->findResource("appdata","down.wav"); m_typeWriterSound = KGlobal::dirs()->findResource("appdata","typewriter.wav"); - connect(m_statusWidget->levelUpBtn, SIGNAL(clicked()), this, SLOT(levelUp()) ); - connect(m_statusWidget->levelDownBtn, SIGNAL(clicked()), this, SLOT(levelDown()) ); - connect(m_trainingTimer, SIGNAL(timeout()), this, SLOT(timerTick()) ); + connect(m_statusWidget->levelUpBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(levelUp()) ); + connect(m_statusWidget->levelDownBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(levelDown()) ); + connect(m_trainingTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(timerTick()) ); } // ---------------------------------------------------------------------------- @@ -73,7 +73,7 @@ void KTouchTrainer::gotoFirstLine() { } // ---------------------------------------------------------------------------- -void KTouchTrainer::keyPressed(QChar key) { +void KTouchTrainer::keyPressed(TQChar key) { // NOTE : In this function we need to distinguish between left and right // typing. Use the config setting Prefs::right2LeftTyping() for that. @@ -81,13 +81,13 @@ void KTouchTrainer::keyPressed(QChar key) { if (m_teacherText==m_studentText) { // if already at end of line, don't add more chars /// \todo Flash the line when line complete - if (Prefs::beepOnError()) QApplication::beep(); + if (Prefs::beepOnError()) TQApplication::beep(); return; } // remember length of student text without added character unsigned int old_student_text_len = m_studentText.length(); // compose new student text depending in typing direction - QString new_student_text = m_studentText; + TQString new_student_text = m_studentText; if (Prefs::right2LeftTyping()) new_student_text = key + new_student_text; else @@ -95,7 +95,7 @@ void KTouchTrainer::keyPressed(QChar key) { // donĀ“t allow excessive amounts of characters per line if (!m_slideLineWidget->canAddCharacter(new_student_text)) { - if (Prefs::beepOnError()) QApplication::beep(); + if (Prefs::beepOnError()) TQApplication::beep(); return; } // store the new student text @@ -105,7 +105,7 @@ void KTouchTrainer::keyPressed(QChar key) { statsAddCorrectChar(key); // ok, all student text is correct else { // nope, the key was wrong : beep !!! - if (Prefs::beepOnError()) QApplication::beep(); + if (Prefs::beepOnError()) TQApplication::beep(); // check if the key is the first wrong key that was mistyped. Only then add it // to the wrong char statistics. if (Prefs::right2LeftTyping()) { @@ -149,11 +149,11 @@ void KTouchTrainer::backspacePressed() { if (m_teacherText.left(len)==m_studentText) m_keyboardWidget->newKey(m_teacherText[len]); else - m_keyboardWidget->newKey(QChar(8)); + m_keyboardWidget->newKey(TQChar(8)); } else { /// \todo Flash line when Backspace on empty line - QApplication::beep(); + TQApplication::beep(); } } // ---------------------------------------------------------------------------- @@ -161,7 +161,7 @@ void KTouchTrainer::backspacePressed() { void KTouchTrainer::enterPressed() { if (m_trainingPaused) continueTraining(); if (m_studentText!=m_teacherText) { - QApplication::beep(); + TQApplication::beep(); return; }; @@ -241,12 +241,12 @@ void KTouchTrainer::updateWidgets() { if (studentLineCorrect()) { // ok, all student text is correct if (m_teacherText.length()==m_studentText.length()) - m_keyboardWidget->newKey(QChar(13)); // we have reached the end of the line + m_keyboardWidget->newKey(TQChar(13)); // we have reached the end of the line else m_keyboardWidget->newKey(m_teacherText[m_studentText.length()]); } else { - m_keyboardWidget->newKey(QChar(8)); // wrong key, user must now press backspace + m_keyboardWidget->newKey(TQChar(8)); // wrong key, user must now press backspace } updateWordCount(); // here we first update the word count updateStatusBar(); // and then the status bar @@ -317,12 +317,12 @@ void KTouchTrainer::storeTrainingStatistics() { // are there level stats to be stored? if (m_levelStats.m_elapsedTime != 0) { //kdDebug() << "[KTouchTrainer::storeTrainingStatistics] Storing level statistics!" << endl; - m_levelStats.m_timeRecorded = QDateTime::currentDateTime(); + m_levelStats.m_timeRecorded = TQDateTime::currentDateTime(); data.m_levelStats.push_back( m_levelStats ); } if (m_sessionStats.m_elapsedTime != 0) { //kdDebug() << "[KTouchTrainer::storeTrainingStatistics] Storing session statistics!" << endl; - m_sessionStats.m_timeRecorded = QDateTime::currentDateTime(); + m_sessionStats.m_timeRecorded = TQDateTime::currentDateTime(); data.m_sessionStats.push_back( m_sessionStats ); } } @@ -388,7 +388,7 @@ void KTouchTrainer::timerTick() { // *** Private functions *** void KTouchTrainer::levelAllComplete() { - QMessageBox::information(0, i18n("You rock!"), + TQMessageBox::information(0, i18n("You rock!"), i18n("You have finished this training exercise.\n" "This training session will start from the beginning.")); statsChangeLevel(); @@ -419,7 +419,7 @@ void KTouchTrainer::updateStatusBar() const { } // ---------------------------------------------------------------------------- -void KTouchTrainer::updateStatusBarMessage(const QString& message) const { +void KTouchTrainer::updateStatusBarMessage(const TQString& message) const { KTouchPtr->changeStatusbarMessage(message); } // ---------------------------------------------------------------------------- @@ -430,7 +430,7 @@ void KTouchTrainer::updateWordCount() { int words = 0; bool space = true; for (unsigned int i=0; i<m_studentText.length(); ++i) { - bool is_space = (m_studentText[i] == QChar(' ')); + bool is_space = (m_studentText[i] == TQChar(' ')); if (is_space) { if (space) continue; // two spaces after each other... ignore else { @@ -451,19 +451,19 @@ void KTouchTrainer::updateWordCount() { } // ---------------------------------------------------------------------------- -void KTouchTrainer::statsAddCorrectChar(QChar key) { +void KTouchTrainer::statsAddCorrectChar(TQChar key) { m_levelStats.addCorrectChar(key); m_sessionStats.addCorrectChar(key); } // ---------------------------------------------------------------------------- -void KTouchTrainer::statsAddWrongChar(QChar key) { +void KTouchTrainer::statsAddWrongChar(TQChar key) { m_levelStats.addWrongChar(key); m_sessionStats.addWrongChar(key); } // ---------------------------------------------------------------------------- -void KTouchTrainer::statsRemoveCorrectChar(QChar) { +void KTouchTrainer::statsRemoveCorrectChar(TQChar) { m_levelStats.removeCorrectChar(); m_sessionStats.removeCorrectChar(); } @@ -487,7 +487,7 @@ void KTouchTrainer::statsChangeLevel() { // are there level stats to be stored? if (m_levelStats.m_elapsedTime != 0) { //kdDebug() << "[KTouchTrainer::storeTrainingStatistics] Storing level statistics!" << endl; - m_levelStats.m_timeRecorded = QDateTime::currentDateTime(); + m_levelStats.m_timeRecorded = TQDateTime::currentDateTime(); data.m_levelStats.push_back( m_levelStats ); } // clear level stats diff --git a/ktouch/src/ktouchtrainer.h b/ktouch/src/ktouchtrainer.h index 46c9d02c..f4b7fb11 100644 --- a/ktouch/src/ktouchtrainer.h +++ b/ktouch/src/ktouchtrainer.h @@ -17,7 +17,7 @@ #include <config.h> #endif -#include <qobject.h> +#include <tqobject.h> #include "ktouchstatisticsdata.h" @@ -57,7 +57,7 @@ class KTouchLecture; /// The member function updateWidgets() updates all training related widgets (status widget, slide line, /// and the statusbar of the main window). In this member function also the word count of the current line /// is updated. -class KTouchTrainer : public QObject { +class KTouchTrainer : public TQObject { Q_OBJECT public: /// Constructor. @@ -72,7 +72,7 @@ class KTouchTrainer : public QObject { void gotoFirstLevel() { m_level=0; gotoFirstLine(); } /// Processes the character 'key' and updates the widgets and statistics. /// If the training session was started and in waiting state the timer is started and the actuall training begins. - void keyPressed(QChar key); + void keyPressed(TQChar key); /// Will be called when a character has been removed (recalculates the variables and updates the widgets). void backspacePressed(); /// Will be called when "enter" has been pressed (displays next line). @@ -105,11 +105,11 @@ class KTouchTrainer : public QObject { unsigned int m_level; ///< Current level number (zero based). unsigned int m_line; ///< Current line number (zero based). - QString m_teacherText; ///< The currently displayed teacher text. - QString m_studentText; ///< The currently typed student text. + TQString m_teacherText; ///< The currently displayed teacher text. + TQString m_studentText; ///< The currently typed student text. bool m_trainingPaused; ///< Indicates whether we have paused the training session or not. - QTimer *m_trainingTimer; ///< The timer responsable for updating the speed LCD widget. + TQTimer *m_trainingTimer; ///< The timer responsable for updating the speed LCD widget. KTouchLevelStats m_levelStats; ///< Contains the statistics for the current level alone. KTouchSessionStats m_sessionStats; ///< Contains the statistics for the current session (multiple levels). @@ -133,15 +133,15 @@ class KTouchTrainer : public QObject { /// Updates the statusbar of the main window. void updateStatusBar() const; /// Updates the message in the statusbar of the main window. - void updateStatusBarMessage(const QString& message) const; + void updateStatusBarMessage(const TQString& message) const; /// Updates the word count in the current student text line. void updateWordCount(); /// Adds a correct character count to the current statistics. - void statsAddCorrectChar(QChar key); + void statsAddCorrectChar(TQChar key); /// Adds a wrong character count to the current statistics. - void statsAddWrongChar(QChar key); + void statsAddWrongChar(TQChar key); /// Removes a correctly typed character count. - void statsRemoveCorrectChar(QChar); + void statsRemoveCorrectChar(TQChar); /// Adds some elapsed time (in seconds) to the statistics. void statsAddTime(double dt); /// Stores level stats and resets level stats (this function is called from levelUp() and levelDown() diff --git a/ktouch/src/ktouchutils.cpp b/ktouch/src/ktouchutils.cpp index af039f2c..a59dbfd9 100644 --- a/ktouch/src/ktouchutils.cpp +++ b/ktouch/src/ktouchutils.cpp @@ -10,25 +10,25 @@ * (at your option) any later version. * ***************************************************************************/ -#include <qtextstream.h> -#include <qstringlist.h> -#include <qmap.h> +#include <tqtextstream.h> +#include <tqstringlist.h> +#include <tqmap.h> #include <kdebug.h> #include "ktouchutils.h" -QString format_speed(double speed) { +TQString format_speed(double speed) { unsigned int mins = static_cast<unsigned int>(speed); unsigned int secs = static_cast<unsigned int>(speed*60) - mins*60; - return QString("%1' %2''").arg(mins).arg(secs); + return TQString("%1' %2''").arg(mins).arg(secs); } -void sort_lists(QStringList& text, QStringList& data) { +void sort_lists(TQStringList& text, TQStringList& data) { if (text.count() != data.count()) return; // invalid input, no sorting possible - QMap<QString, QString> sort_map; - QStringList::const_iterator key_it = text.constBegin(); - QStringList::const_iterator val_it = data.constBegin(); + TQMap<TQString, TQString> sort_map; + TQStringList::const_iterator key_it = text.constBegin(); + TQStringList::const_iterator val_it = data.constBegin(); while (key_it != text.constEnd()) { // kdDebug() << *key_it << " " << *val_it << endl; sort_map[*key_it++] = *val_it++; diff --git a/ktouch/src/ktouchutils.h b/ktouch/src/ktouchutils.h index 53b0daee..2a1c7801 100644 --- a/ktouch/src/ktouchutils.h +++ b/ktouch/src/ktouchutils.h @@ -17,12 +17,12 @@ #include <config.h> #endif -#include <qstring.h> +#include <tqstring.h> /// Formats the speed (given in chars/min) and creates a nice looking text. -QString format_speed(double speed); +TQString format_speed(double speed); /// Sorts both lists but uses only the values in "text" for sorting. -void sort_lists(QStringList& text, QStringList& data); +void sort_lists(TQStringList& text, TQStringList& data); #endif // KTOUCHUTILS_H diff --git a/ktouch/src/main.cpp b/ktouch/src/main.cpp index a5159ad1..6fc244ba 100644 --- a/ktouch/src/main.cpp +++ b/ktouch/src/main.cpp @@ -60,8 +60,8 @@ int main(int argc, char **argv) KTouchSplash splash; // create the splash screen splash.setHideEnabled( true ); // allow user to click the splash screen away splash.show(); // show it - QTimer splashTimer; - splashTimer.connect(&splashTimer, SIGNAL(timeout()), &splash, SLOT(hide())); + TQTimer splashTimer; + splashTimer.connect(&splashTimer, TQT_SIGNAL(timeout()), &splash, TQT_SLOT(hide())); splashTimer.start(2000, true); // start singleshot timer to hide the splashscreen */ |