summaryrefslogtreecommitdiffstats
path: root/ktouch/src/ktouch.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:44:41 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:44:41 +0000
commita374efce3a207b39514be3c52264091400ce297e (patch)
tree77bdf654b55826d4f59b53a5621310206bcaead1 /ktouch/src/ktouch.cpp
parentf81a494f3957d5cf38c787973415597941934727 (diff)
downloadtdeedu-a374efce3a207b39514be3c52264091400ce297e.tar.gz
tdeedu-a374efce3a207b39514be3c52264091400ce297e.zip
TQt4 port kdeedu
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1236073 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ktouch/src/ktouch.cpp')
-rw-r--r--ktouch/src/ktouch.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/ktouch/src/ktouch.cpp b/ktouch/src/ktouch.cpp
index 632aabe1..4480b80c 100644
--- a/ktouch/src/ktouch.cpp
+++ b/ktouch/src/ktouch.cpp
@@ -22,7 +22,7 @@
#include <tqcheckbox.h>
#include <tqlabel.h>
#include <tqgroupbox.h>
-//#include <qimevent.h>
+//#include <tqimevent.h>
// KDE Header
#include <klocale.h>
@@ -64,7 +64,7 @@ KTouch::KTouch()
m_keyboardWidget(NULL),
m_trainer(NULL)
{
- setFocusPolicy(StrongFocus);
+ setFocusPolicy(TQ_StrongFocus);
setInputMethodEnabled(true);
// Set global KTouchPtr to the main KTouch Object
@@ -75,7 +75,7 @@ KTouch::KTouch()
setupActions();
// create the GUI reading the ui.rc file
if (!initialGeometrySet())
- resize( TQSize(700, 510).expandedTo(minimumSizeHint()));
+ resize( TQSize(700, 510).expandedTo(tqminimumSizeHint()));
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(TQString::null);
+ Prefs::setCurrentLectureFile(TQString());
m_defaultLectureAction->setCurrentItem(-1);
}
else {
@@ -177,12 +177,12 @@ void KTouch::keyPressEvent(TQKeyEvent *keyEvent) {
m_trainer->continueTraining();
}
if (keyEvent->text().length() > 1) {
- kdDebug() << "[KTouch::keyPressEvent] text = '" << keyEvent->text() << "'" << endl;
+ kdDebug() << "[KTouch::keyPressEvent] text = '" << keyEvent->text().data() << "'" << endl;
}
- TQChar key = keyEvent->text().at(0); // get first unicode character
+ TQChar key = keyEvent->text().at(0); // get first tqunicode character
// HACK : manually filter out known dead keys
// bool has_dead_key = true;
- switch (key.unicode()) {
+ switch (key.tqunicode()) {
case 94 : m_lastDeadKey = TQChar(uint(94)); break;
case 176 : m_lastDeadKey = TQChar(uint(176)); break;
case 180 : m_lastDeadKey = TQChar(uint(180)); break;
@@ -285,7 +285,7 @@ void KTouch::configCommonColorsToggled(bool on) {
// The action File->Open lecture...
void KTouch::fileOpenLecture() {
trainingPause();
- KURL tmp = KFileDialog::getOpenURL(TQString::null, TQString::null, this, i18n("Select Training Lecture File") );
+ KURL tmp = KFileDialog::getOpenURL(TQString(), TQString(), this, i18n("Select Training Lecture File") );
if (!tmp.isEmpty()) {
// first store training statistics
m_trainer->storeTrainingStatistics();
@@ -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, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(applyPreferences()));
+ connect(dialog, TQT_SIGNAL(settingsChanged()), TQT_TQOBJECT(this), TQT_SLOT(applyPreferences()));
// TODO : Connect some other buttons/check boxes of the dialog
connect(m_pageGeneral->kcfg_OverrideLectureFont, TQT_SIGNAL(toggled(bool)),
- this, TQT_SLOT(configOverrideLectureFontToggled(bool)));
+ TQT_TQOBJECT(this), TQT_SLOT(configOverrideLectureFontToggled(bool)));
connect(m_pageKeyboard->kcfg_OverrideKeyboardFont, TQT_SIGNAL(toggled(bool)),
- this, TQT_SLOT(configOverrideKeyboardFontToggled(bool)));
+ TQT_TQOBJECT(this), TQT_SLOT(configOverrideKeyboardFontToggled(bool)));
connect(m_pageTraining->kcfg_AutoLevelChange, TQT_SIGNAL(toggled(bool)),
- this, TQT_SLOT(configAutoLevelChangeToggled(bool)));
+ TQT_TQOBJECT(this), TQT_SLOT(configAutoLevelChangeToggled(bool)));
connect(m_pageColors->kcfg_CommonTypingLineColors, TQT_SIGNAL(toggled(bool)),
- this, TQT_SLOT(configCommonColorsToggled(bool)));
+ TQT_TQOBJECT(this), TQT_SLOT(configCommonColorsToggled(bool)));
// call the functions to enable/disable controls depending on settings
configOverrideLectureFontToggled(Prefs::overrideLectureFont());
configOverrideKeyboardFontToggled(Prefs::overrideKeyboardFont());
@@ -459,18 +459,18 @@ void KTouch::changeStatusbarStats(unsigned int level_correct, unsigned int level
unsigned int session_correct, unsigned int session_total, unsigned int session_words)
{
statusBar()->changeItem(i18n( "Level: Correct/Total chars: %1/%2 Words: %3")
- .arg(level_correct).arg(level_total).arg(level_words), 1);
+ .tqarg(level_correct).tqarg(level_total).tqarg(level_words), 1);
statusBar()->changeItem(i18n( "Session: Correct/Total chars: %1/%2 Words: %3")
- .arg(session_correct).arg(session_total).arg(session_words), 2);
+ .tqarg(session_correct).tqarg(session_total).tqarg(session_words), 2);
}
// ----------------------------------------------------------------------------
void KTouch::changeKeyboard(int num) {
if (static_cast<unsigned int>(num)>=m_keyboardFiles.count()) return;
Prefs::setCurrentKeyboardFile( m_keyboardFiles[num] );
-// kdDebug() << "[KTouch::changeKeyboard] new keyboard layout = " << Prefs::currentKeyboardFile() << endl;
+// kdDebug() << "[KTouch::changeKeyboard] new keyboard tqlayout = " << Prefs::currentKeyboardFile() << endl;
m_keyboardLayoutAction->setCurrentItem(num);
- // call Apply-Preferenzes in "noisy"-mode, pop up an error if the chosen layout file is corrupt
+ // call Apply-Preferenzes in "noisy"-mode, pop up an error if the chosen tqlayout file is corrupt
m_keyboardWidget->applyPreferences(this, false);
}
// ----------------------------------------------------------------------------
@@ -489,7 +489,7 @@ void KTouch::changeLecture(int num) {
KTouchLecture l;
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) );
+ KMessageBox::sorry(0, i18n("Could not tqfind/open the lecture file '%1'.").tqarg(fileName) );
m_defaultLectureAction->setCurrentItem(-1);
}
else {
@@ -608,11 +608,11 @@ void KTouch::init() {
//kdDebug() << "[KTouch::init] populating file lists..." << endl;
updateFileLists(); // create lists with default lecture/keyboard/examination files/colour scheme files
//kdDebug() << "[KTouch::init] " << m_lectureFiles.count() << " lectures available" << endl;
- //kdDebug() << "[KTouch::init] " << m_keyboardFiles.count() << " keyboard layouts available" << endl;
+ //kdDebug() << "[KTouch::init] " << m_keyboardFiles.count() << " keyboard tqlayouts available" << endl;
//kdDebug() << "[KTouch::init] " << m_examinationFiles.count() << " examination files available" << endl;
if (Prefs::currentLectureFile() == "default") {
- Prefs::setCurrentLectureFile(TQString::null);
+ Prefs::setCurrentLectureFile(TQString());
// /// \todo look up a lecture in the language of the KDE locale
/* TQString default_lecture = "default";
if (m_lectureFiles.count() > 0) default_lecture = m_lectureFiles[0];
@@ -620,21 +620,21 @@ 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) {
+ // if keyboard tqlayout (loaded by Prefs is not available (e.g. the
+ // tqlayout file has been deleted) switch to default keyboard
+ if (m_keyboardFiles.tqcontains(Prefs::currentKeyboardFile() )==0) {
TQString default_keyboard;
// determine locale
TQString lang = KGlobal::locale()->language();
TQString fname = lang + ".keyboard";
// try to find keyboard with current locale
TQStringList::const_iterator it = m_keyboardFiles.constBegin();
- while (it != m_keyboardFiles.constEnd() && (*it).find(fname) == -1) ++it;
+ while (it != m_keyboardFiles.constEnd() && (*it).tqfind(fname) == -1) ++it;
if (it == m_keyboardFiles.constEnd()) {
fname = lang.left(2) + ".keyboard";
// try to find more general version
it = m_keyboardFiles.constBegin();
- while (it != m_keyboardFiles.constEnd() && (*it).find(fname) == -1) ++it;
+ while (it != m_keyboardFiles.constEnd() && (*it).tqfind(fname) == -1) ++it;
}
if (it != m_keyboardFiles.constEnd())
@@ -652,18 +652,18 @@ void KTouch::init() {
}
// ----------------------------------------------------------------------------
-// Creates the layout and GUI setup for a practice session
+// Creates the tqlayout and GUI setup for a practice session
void KTouch::initTrainingSession() {
- //kdDebug() << "[KTouch::initTrainingSession] setting up layouts and widgets for new training session..." << endl;
+ //kdDebug() << "[KTouch::initTrainingSession] setting up tqlayouts 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 TQSizePolicy)
TQVBox * mainLayout = new TQVBox( this );
- m_statusWidget = new KTouchStatus( mainLayout );
+ m_statusWidget = new KTouchtqStatus( mainLayout );
m_slideLineWidget = new KTouchSlideLine( mainLayout );
- m_slideLineWidget->setSizePolicy( TQSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Expanding, 0, 1) );
+ m_slideLineWidget->tqsetSizePolicy( TQSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Expanding, 0, 1) );
m_keyboardWidget = new KTouchKeyboardWidget( mainLayout );
- m_keyboardWidget->setSizePolicy(TQSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Expanding, 0, 3) );
+ m_keyboardWidget->tqsetSizePolicy(TQSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Expanding, 0, 3) );
setCentralWidget(mainLayout);
// apply the settings to the widgets
m_slideLineWidget->applyPreferences();
@@ -684,40 +684,40 @@ void KTouch::initTrainingSession() {
void KTouch::setupActions() {
// *** File menu ***
new KAction(i18n("&Open lecture..."), "open_lecture", 0,
- this, TQT_SLOT(fileOpenLecture()), actionCollection(), "file_openlecture");
+ TQT_TQOBJECT(this), TQT_SLOT(fileOpenLecture()), actionCollection(), "file_openlecture");
new KAction(i18n("&Edit lecture..."), "edit_lecture", 0,
- this, TQT_SLOT(fileEditLecture()), actionCollection(), "file_editlecture");
+ TQT_TQOBJECT(this), TQT_SLOT(fileEditLecture()), actionCollection(), "file_editlecture");
new KAction(i18n("&Edit color scheme..."), "edit_colors", 0,
- this, TQT_SLOT(fileEditColors()), actionCollection(), "file_editcolors");
+ TQT_TQOBJECT(this), TQT_SLOT(fileEditColors()), actionCollection(), "file_editcolors");
// new KAction(i18n("&Edit Keyboard..."), "edit_keyboard", 0,
-// this, TQT_SLOT(fileEditKeyboard()), actionCollection(), "file_editkeyboard");
- KStdAction::quit(this, TQT_SLOT(fileQuit()), actionCollection());
+// TQT_TQOBJECT(this), TQT_SLOT(fileEditKeyboard()), actionCollection(), "file_editkeyboard");
+ KStdAction::quit(TQT_TQOBJECT(this), TQT_SLOT(fileQuit()), actionCollection());
// *** Training menu ***
new KAction(i18n("&Start New Session"), "launch", 0,
- this, TQT_SLOT(trainingNewSession()), actionCollection(), "training_newsession");
+ TQT_TQOBJECT(this), TQT_SLOT(trainingNewSession()), actionCollection(), "training_newsession");
m_trainingPause = new KAction(i18n("&Pause Session"), "player_pause", 0,
- this, TQT_SLOT(trainingPause()), actionCollection(), "training_pause");
+ TQT_TQOBJECT(this), TQT_SLOT(trainingPause()), actionCollection(), "training_pause");
new KAction(i18n("&Lecture Statistics"), "kalarm", 0,
- this, TQT_SLOT(trainingStatistics()), actionCollection(), "training_stats");
+ TQT_TQOBJECT(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 = new KSelectAction(i18n("Default &Lectures"), 0, TQT_TQOBJECT(this), 0, actionCollection(), "default_lectures");
m_defaultLectureAction->setMenuAccelsEnabled(false);
m_defaultLectureAction->setItems(m_lectureTitles);
m_defaultLectureAction->setCurrentItem(0);
- connect (m_defaultLectureAction, TQT_SIGNAL(activated(int)), this, TQT_SLOT(changeLecture(int)));
+ connect (m_defaultLectureAction, TQT_SIGNAL(activated(int)), TQT_TQOBJECT(this), TQT_SLOT(changeLecture(int)));
// *** Settings menu ***
- 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");
+ KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(optionsPreferences()), actionCollection());
+ // Setup menu entries for keyboard tqlayouts
+ m_keyboardLayoutAction= new KSelectAction(i18n("&Keyboard Layouts"), 0, TQT_TQOBJECT(this), 0, actionCollection(), "keyboard_layouts");
m_keyboardLayoutAction->setMenuAccelsEnabled(false);
m_keyboardLayoutAction->setItems(m_keyboardTitles);
- connect (m_keyboardLayoutAction, TQT_SIGNAL(activated(int)), this, TQT_SLOT(changeKeyboard(int)));
+ connect (m_keyboardLayoutAction, TQT_SIGNAL(activated(int)), TQT_TQOBJECT(this), TQT_SLOT(changeKeyboard(int)));
// Setup menu entries for colour schemes
- m_keyboardColorAction = new KSelectAction(i18n("&Color Schemes"), 0, this, 0, actionCollection(), "keyboard_schemes");
+ m_keyboardColorAction = new KSelectAction(i18n("&Color Schemes"), 0, TQT_TQOBJECT(this), 0, actionCollection(), "keyboard_schemes");
TQStringList schemes_list;
for (unsigned int i=0; i<KTouchColorScheme::m_colorSchemes.count(); ++i)
schemes_list.append(KTouchColorScheme::m_colorSchemes[i].m_name);
@@ -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, TQT_SIGNAL(activated(int)), this, TQT_SLOT(changeColor(int)));
+ connect (m_keyboardColorAction, TQT_SIGNAL(activated(int)), TQT_TQOBJECT(this), TQT_SLOT(changeColor(int)));
}
// ----------------------------------------------------------------------------
@@ -753,9 +753,9 @@ void KTouch::updateFileLists() {
// TODO : search in i18n() directories
m_keyboardFiles = dirs->findAllResources("data","ktouch/*.keyboard");
- // remove the number layout, since this is the necessary default layout and will be
+ // remove the number tqlayout, since this is the necessary default tqlayout and will be
// added anyway
- TQStringList::iterator it = m_keyboardFiles.find("number.keyboard");
+ TQStringList::iterator it = m_keyboardFiles.tqfind("number.keyboard");
if (it!=m_keyboardFiles.end()) m_keyboardFiles.remove(it);
m_keyboardTitles.clear();
@@ -826,7 +826,7 @@ void KTouch::updateLectureActionCheck() {
int num = 0;
TQStringList::iterator it = m_lectureFiles.begin();
TQString fname = Prefs::currentLectureFile();
- while (it != m_lectureFiles.end() && (*it).find(fname) == -1) {
+ while (it != m_lectureFiles.end() && (*it).tqfind(fname) == -1) {
++it;
++num;
}
@@ -839,7 +839,7 @@ void KTouch::updateKeyboardActionCheck() {
int num = 0;
TQStringList::iterator it = m_keyboardFiles.begin();
TQString fname = Prefs::currentKeyboardFile();
- while (it != m_keyboardFiles.end() && (*it).find(fname) == -1) {
+ while (it != m_keyboardFiles.end() && (*it).tqfind(fname) == -1) {
++it;
++num;
}
@@ -866,7 +866,7 @@ void KTouch::imEndEvent(TQIMEvent *e) {
if (!e->text().isEmpty()) {
if (e->text() == "^") {
TQKeyEvent *ev = new TQKeyEvent (TQEvent::KeyPress,
- Qt::Key_AsciiCircum, '^', 0,
+ TQt::Key_AsciiCircum, '^', 0,
TQString("^"));
keyPressEvent(ev);
delete ev;