From a374efce3a207b39514be3c52264091400ce297e Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 11 Jun 2011 04:44:41 +0000 Subject: 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 --- blinken/src/artsplayer.h | 3 ++- blinken/src/blinken.cpp | 52 ++++++++++++++++++++--------------------- blinken/src/blinken.h | 5 ++-- blinken/src/blinkengame.h | 3 ++- blinken/src/button.cpp | 12 +++++----- blinken/src/counter.cpp | 2 +- blinken/src/fontutils.cpp | 4 ++-- blinken/src/highscoredialog.cpp | 40 +++++++++++++++---------------- blinken/src/highscoredialog.h | 4 ++-- blinken/src/number.cpp | 30 ++++++++++++------------ 10 files changed, 79 insertions(+), 76 deletions(-) (limited to 'blinken/src') diff --git a/blinken/src/artsplayer.h b/blinken/src/artsplayer.h index 64586074..97f9f62c 100644 --- a/blinken/src/artsplayer.h +++ b/blinken/src/artsplayer.h @@ -34,9 +34,10 @@ namespace KDE class TQTimer; -class artsPlayer : public QObject +class artsPlayer : public TQObject { Q_OBJECT + TQ_OBJECT public: artsPlayer(); ~artsPlayer(); diff --git a/blinken/src/blinken.cpp b/blinken/src/blinken.cpp index 202a9a99..36a8f93c 100644 --- a/blinken/src/blinken.cpp +++ b/blinken/src/blinken.cpp @@ -144,7 +144,7 @@ void blinken::paintEvent(TQPaintEvent *) p.setBrush(m_fillColor); p.drawPie(169, 192, 4, 58, 1440, 2880); p.drawPie(465, 192, 4, 58, -1440, 2880); - p.setPen(TQPen(Qt::black, 3)); + p.setPen(TQPen(TQt::black, 3)); p.fillRect(171, 192, 296, 58, m_fillColor); p.drawLine(169, 192, 469, 192); p.drawLine(169, 250, 469, 250); @@ -184,16 +184,16 @@ void blinken::paintEvent(TQPaintEvent *) if (sizeAux > size) size = sizeAux; f1.setPointSize(size); #ifndef WITHOUT_ARTS - area = p.boundingRect(TQRect(), Qt::AlignAuto, sounds); + area = p.boundingRect(TQRect(), TQt::AlignAuto, sounds); area.moveBy(212, 221 - (area.height() / 2)); - p.drawText(area, Qt::AlignCenter, sounds); + p.drawText(area, TQt::AlignCenter, sounds); m_soundRect = m_soundRect.unite(area); #endif if (!m_alwaysUseNonCoolFont) { - area = p.boundingRect(TQRect(), Qt::AlignAuto, font); + area = p.boundingRect(TQRect(), TQt::AlignAuto, font); area.moveBy(426 - area.width(), 221 - (area.height() / 2)); - p.drawText(area, Qt::AlignCenter, font); + p.drawText(area, TQt::AlignCenter, font); m_fontRect = m_fontRect.unite(area); } @@ -227,7 +227,7 @@ void blinken::keyPressEvent(TQKeyEvent *e) if (i < 4) { - if (e -> key() == Qt::Key_Escape) + if (e -> key() == TQt::Key_Escape) { m_buttons[i] -> setSelected(false); update(); @@ -267,7 +267,7 @@ void blinken::keyReleaseEvent(TQKeyEvent *e) { if (e -> isAutoRepeat()) return; - if (e -> state() == Qt::ControlButton && e -> stateAfter() != Qt::ControlButton && (m_game.phase() == blinkenGame::starting || m_game.phase() == blinkenGame::choosingLevel)) + if (e -> state() == TQt::ControlButton && e -> stateAfter() != TQt::ControlButton && (m_game.phase() == blinkenGame::starting || m_game.phase() == blinkenGame::choosingLevel)) { m_showPreferences = !m_showPreferences; for (int i = 0; i < 4; i++) m_buttons[i] -> setSelected(false); @@ -289,13 +289,13 @@ void blinken::mousePressEvent(TQMouseEvent *e) hsd->showLevel(1); m_updateButtonHighlighting = true; } - else if (m_showPreferences && m_fontRect.contains(e -> pos()) && !m_alwaysUseNonCoolFont) + else if (m_showPreferences && m_fontRect.tqcontains(e -> pos()) && !m_alwaysUseNonCoolFont) { blinkenSettings::setCustomFont(!blinkenSettings::customFont()); blinkenSettings::writeConfig(); update(); } - else if (m_showPreferences && m_soundRect.contains(e -> pos())) + else if (m_showPreferences && m_soundRect.tqcontains(e -> pos())) { blinkenSettings::setPlaySounds(!blinkenSettings::playSounds()); blinkenSettings::writeConfig(); @@ -316,9 +316,9 @@ void blinken::mousePressEvent(TQMouseEvent *e) else if (m_game.phase() == blinkenGame::choosingLevel) { int level = 0; - if (m_levelsRect[1].contains(e -> pos())) level = 1; - else if (m_levelsRect[0].contains(e -> pos())) level = 2; - else if (m_levelsRect[2].contains(e -> pos())) level = 3; + if (m_levelsRect[1].tqcontains(e -> pos())) level = 1; + else if (m_levelsRect[0].tqcontains(e -> pos())) level = 2; + else if (m_levelsRect[2].tqcontains(e -> pos())) level = 3; if (level) { for(int i = 0; i < 3; i++) m_overLevels[i] = false; @@ -639,7 +639,7 @@ void blinken::drawText(TQPainter &p, const TQString &text, const TQPoint ¢er if (bold) f.setBold(true); p.setFont(f); - r = p.boundingRect(TQRect(), Qt::AlignAuto, text); + r = p.boundingRect(TQRect(), TQt::AlignAuto, text); r = TQRect(0, 0, r.width() + xMargin, r.height() + yMargin); r.moveBy(center.x() - r.width() / 2, center.y() - r.height() / 2); @@ -652,7 +652,7 @@ void blinken::drawText(TQPainter &p, const TQString &text, const TQPoint ¢er if (!highlight) p.setPen(m_fontColor); else p.setPen(m_fontHighlightColor); - p.drawText(r, Qt::AlignCenter, text); + p.drawText(r, TQt::AlignCenter, text); if (rect) *rect = r; p.setFont(oldFont); @@ -665,7 +665,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p) m_updateButtonHighlighting = false; haveToUpdate = false; - if (m_highscoreRect.contains(p)) + if (m_highscoreRect.tqcontains(p)) { if (!m_overHighscore) { @@ -679,7 +679,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p) haveToUpdate = true; } - if (m_menuRect.contains(p)) + if (m_menuRect.tqcontains(p)) { if (!m_overMenu) { @@ -699,7 +699,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p) } else if (m_overMenu) { - if (m_aboutKDERect.contains(p)) + if (m_aboutKDERect.tqcontains(p)) { if (!m_overAboutKDE) { @@ -709,7 +709,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p) haveToUpdate = true; } } - else if (m_aboutBlinkenRect.contains(p)) + else if (m_aboutBlinkenRect.tqcontains(p)) { if (!m_overAboutBlinken) { @@ -719,7 +719,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p) haveToUpdate = true; } } - else if (m_manualRect.contains(p)) + else if (m_manualRect.tqcontains(p)) { if (!m_overManual) { @@ -739,7 +739,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p) } } - if (!m_showPreferences && m_centralLettersRect.contains(p)) + if (!m_showPreferences && m_centralLettersRect.tqcontains(p)) { m_overCentralLetters = true; haveToUpdate = true; @@ -750,7 +750,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p) haveToUpdate = true; } - if (m_showPreferences && m_soundRect.contains(p)) + if (m_showPreferences && m_soundRect.tqcontains(p)) { m_overSound = true; haveToUpdate = true; @@ -761,7 +761,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p) haveToUpdate = true; } - if (m_showPreferences && m_fontRect.contains(p) && !m_alwaysUseNonCoolFont) + if (m_showPreferences && m_fontRect.tqcontains(p) && !m_alwaysUseNonCoolFont) { m_overFont = true; haveToUpdate = true; @@ -772,7 +772,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p) haveToUpdate = true; } - if (m_counterRect.contains(p)) + if (m_counterRect.tqcontains(p)) { m_overCounter = true; haveToUpdate = true; @@ -783,7 +783,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p) haveToUpdate = true; } - if (m_quitRect.contains(p)) + if (m_quitRect.tqcontains(p)) { if (!m_overQuit) { @@ -805,7 +805,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p) case blinkenGame::waiting1: case blinkenGame::learningTheSequence: case blinkenGame::typingTheSequence: - if (m_centralTextRect.contains(p)) + if (m_centralTextRect.tqcontains(p)) { if (!m_overCentralText) { @@ -823,7 +823,7 @@ void blinken::updateButtonHighlighting(const TQPoint &p) case blinkenGame::choosingLevel: for (int i = 0; i < 3; i++) { - if (m_levelsRect[i].contains(p)) + if (m_levelsRect[i].tqcontains(p)) { if (!m_overLevels[i]) { diff --git a/blinken/src/blinken.h b/blinken/src/blinken.h index 0c45c8a7..6994de20 100644 --- a/blinken/src/blinken.h +++ b/blinken/src/blinken.h @@ -22,9 +22,10 @@ class KHelpMenu; class button; class highScoreDialog; -class blinken : public QWidget +class blinken : public TQWidget { Q_OBJECT + TQ_OBJECT public: blinken(); ~blinken(); @@ -73,7 +74,7 @@ Q_OBJECT // Preferences setting handling bool m_showPreferences; - // if should update the highlighting after the next repaint + // if should update the highlighting after the next tqrepaint bool m_updateButtonHighlighting; // use always the non-cool font? diff --git a/blinken/src/blinkengame.h b/blinken/src/blinkengame.h index 3cdbde6a..40a3c000 100644 --- a/blinken/src/blinkengame.h +++ b/blinken/src/blinkengame.h @@ -17,9 +17,10 @@ class TQTimer; class artsPlayer; -class blinkenGame : public QObject +class blinkenGame : public TQObject { Q_OBJECT + TQ_OBJECT public: blinkenGame(); ~blinkenGame(); diff --git a/blinken/src/button.cpp b/blinken/src/button.cpp index 406112eb..052ef6ed 100644 --- a/blinken/src/button.cpp +++ b/blinken/src/button.cpp @@ -20,24 +20,24 @@ button::button(blinkenGame::color c) : m_selected(false), m_color(c) KConfig *kc = kapp->config(); kc->setGroup("General"); TQString cs = getColorString(); - TQString pixmap = TQString("images/%1h.png").arg(cs); + TQString pixmap = TQString("images/%1h.png").tqarg(cs); switch (c) { case blinkenGame::blue: - m_key = kc->readNumEntry(cs, Qt::Key_3); + m_key = kc->readNumEntry(cs, TQt::Key_3); break; case blinkenGame::yellow: - m_key = kc->readNumEntry(cs, Qt::Key_1); + m_key = kc->readNumEntry(cs, TQt::Key_1); break; case blinkenGame::red: - m_key = kc->readNumEntry(cs, Qt::Key_2); + m_key = kc->readNumEntry(cs, TQt::Key_2); break; case blinkenGame::green: - m_key = kc->readNumEntry(cs, Qt::Key_4); + m_key = kc->readNumEntry(cs, TQt::Key_4); break; default: @@ -115,5 +115,5 @@ TQString button::getColorString() const } // never happens - return TQString::null; + return TQString(); } diff --git a/blinken/src/counter.cpp b/blinken/src/counter.cpp index 93c55109..c3ac7d29 100644 --- a/blinken/src/counter.cpp +++ b/blinken/src/counter.cpp @@ -17,7 +17,7 @@ void counter::paint(TQPainter &p, bool drawScore, int score, bool drawTimer, con { p.save(); p.translate(45, 15); - p.setPen(TQPen(Qt::black, 3)); + p.setPen(TQPen(TQt::black, 3)); p.setBrush(TQColor(40, 40, 40)); if (drawTimer) { diff --git a/blinken/src/fontutils.cpp b/blinken/src/fontutils.cpp index 10d3bc0d..1b4b3b2c 100644 --- a/blinken/src/fontutils.cpp +++ b/blinken/src/fontutils.cpp @@ -24,8 +24,8 @@ int fontUtils::fontSize(TQPainter &p, const TQString &s1, int w, int h) TQFont f = p.font(); f.setPointSize(size); p.setFont(f); - aux1 = p.boundingRect(TQRect(), Qt::AlignAuto, s1); - if (aux1.width() > w || aux1.height() > h) size = QMIN(w * size / aux1.width(), h * size / aux1.height()); + aux1 = p.boundingRect(TQRect(), TQt::AlignAuto, s1); + if (aux1.width() > w || aux1.height() > h) size = TQMIN(w * size / aux1.width(), h * size / aux1.height()); else done = true; } diff --git a/blinken/src/highscoredialog.cpp b/blinken/src/highscoredialog.cpp index 9c5a5287..b5dc749f 100644 --- a/blinken/src/highscoredialog.cpp +++ b/blinken/src/highscoredialog.cpp @@ -27,20 +27,20 @@ static const int namesFontSize = 25; /* scoresWidget */ -class scoresWidget : public QWidget +class scoresWidget : public TQWidget { public: - scoresWidget(TQWidget *parent, const TQValueList< QPair > &scores); + scoresWidget(TQWidget *tqparent, const TQValueList< TQPair > &scores); TQSize calcSize(); protected: void paintEvent(TQPaintEvent *); private: - const TQValueList< QPair > &m_scores; + const TQValueList< TQPair > &m_scores; }; -scoresWidget::scoresWidget(TQWidget *parent, const TQValueList< QPair > &scores) : TQWidget(parent, 0, WStaticContents | WNoAutoErase), m_scores(scores) +scoresWidget::scoresWidget(TQWidget *tqparent, const TQValueList< TQPair > &scores) : TQWidget(tqparent, 0, WStaticContents | WNoAutoErase), m_scores(scores) { } @@ -66,7 +66,7 @@ void scoresWidget::paintEvent(TQPaintEvent *) p.translate(margin, margin); - TQValueList< QPair >::const_iterator it; + TQValueList< TQPair >::const_iterator it; for (it = m_scores.begin(); it != m_scores.end(); ++it) { counter::paint(p, !(*it).second.isEmpty(), (*it).first, false, TQColor(), TQColor(), TQColor()); @@ -92,11 +92,11 @@ TQSize scoresWidget::calcSize() for (int i = 0; i < 3; i++) { lt = 0; - TQValueList< QPair >::const_iterator it; + TQValueList< TQPair >::const_iterator it; for (it = m_scores.begin(); it != m_scores.end(); ++it) { - r = p.boundingRect(TQRect(), Qt::AlignAuto, (*it).second); - lt = QMAX(lt, r.width()); + r = p.boundingRect(TQRect(), TQt::AlignAuto, (*it).second); + lt = TQMAX(lt, r.width()); } } @@ -112,20 +112,20 @@ TQSize scoresWidget::calcSize() /* myTabWidget */ -class myTabWidget : public QTabWidget +class myTabWidget : public TQTabWidget { public: - myTabWidget(TQWidget *parent) : TQTabWidget(parent) {} + myTabWidget(TQWidget *tqparent) : TQTabWidget(tqparent) {} TQSize tabBarSizeHint() const { - return tabBar() -> sizeHint(); + return tabBar() -> tqsizeHint(); } }; /* highScoreDialog */ -highScoreDialog::highScoreDialog(TQWidget *parent) : KDialogBase(parent, 0, true, i18n("Highscores"), KDialogBase::Close) +highScoreDialog::highScoreDialog(TQWidget *tqparent) : KDialogBase(tqparent, 0, true, i18n("Highscores"), KDialogBase::Close) { m_tw = new myTabWidget(this); setMainWidget(m_tw); @@ -133,10 +133,10 @@ highScoreDialog::highScoreDialog(TQWidget *parent) : KDialogBase(parent, 0, true KConfig *cfg = kapp -> config(); for (int i = 1; i <= 3; i++) { - cfg -> setGroup(TQString("Level%1").arg(i)); + cfg -> setGroup(TQString("Level%1").tqarg(i)); for (int j = 1; j <= 5; j++) { - m_scores[i-1].append(qMakePair(cfg->readNumEntry(TQString("Score%1").arg(j)), cfg->readEntry(TQString("Name%1").arg(j)))); + m_scores[i-1].append(tqMakePair(cfg->readNumEntry(TQString("Score%1").tqarg(j)), cfg->readEntry(TQString("Name%1").tqarg(j)))); } } @@ -148,7 +148,7 @@ highScoreDialog::highScoreDialog(TQWidget *parent) : KDialogBase(parent, 0, true bool highScoreDialog::scoreGoodEnough(int level, int score) { level--; - TQValueList< QPair >::iterator it, itEnd; + TQValueList< TQPair >::iterator it, itEnd; it = m_scores[level].begin(); itEnd = m_scores[level].end(); while (it != itEnd && (*it).first >= score) it++; @@ -159,23 +159,23 @@ bool highScoreDialog::scoreGoodEnough(int level, int score) void highScoreDialog::addScore(int level, int score, const TQString &name) { level--; - TQValueList< QPair >::iterator it, itEnd; + TQValueList< TQPair >::iterator it, itEnd; it = m_scores[level].begin(); itEnd = m_scores[level].end(); while (it != itEnd && (*it).first >= score) it++; if (it != itEnd) { - m_scores[level].insert(it, qMakePair(score, name)); + m_scores[level].insert(it, tqMakePair(score, name)); m_scores[level].remove(--m_scores[level].end()); KConfig *cfg = kapp -> config(); - cfg -> setGroup(TQString("Level%1").arg(level + 1)); + cfg -> setGroup(TQString("Level%1").tqarg(level + 1)); int j; for (it = m_scores[level].begin(), j = 1; it != m_scores[level].end(); ++it, j++) { - cfg->writeEntry(TQString("Score%1").arg(j), (*it).first); - cfg->writeEntry(TQString("Name%1").arg(j), (*it).second); + cfg->writeEntry(TQString("Score%1").tqarg(j), (*it).first); + cfg->writeEntry(TQString("Name%1").tqarg(j), (*it).second); } cfg -> sync(); } diff --git a/blinken/src/highscoredialog.h b/blinken/src/highscoredialog.h index 484f392b..e4a9e38b 100644 --- a/blinken/src/highscoredialog.h +++ b/blinken/src/highscoredialog.h @@ -20,13 +20,13 @@ class myTabWidget; class highScoreDialog : private KDialogBase { public: - highScoreDialog(TQWidget *parent); + highScoreDialog(TQWidget *tqparent); bool scoreGoodEnough(int level, int score); void addScore(int level, int score, const TQString &name); void showLevel(int level); - TQValueList< QPair > m_scores[3]; + TQValueList< TQPair > m_scores[3]; myTabWidget *m_tw; }; diff --git a/blinken/src/number.cpp b/blinken/src/number.cpp index 2403f866..27621ee8 100644 --- a/blinken/src/number.cpp +++ b/blinken/src/number.cpp @@ -100,7 +100,7 @@ void number::paintDigit(TQPainter &p, int number) const { // make gcc happy const int *n = m_number0; - int shape; + int tqshape; switch (number) { @@ -141,31 +141,31 @@ void number::paintDigit(TQPainter &p, int number) const break; } - p.setBrush(Qt::red); - p.setPen(Qt::red); + p.setBrush(TQt::red); + p.setPen(TQt::red); for (int i = 0; i < 5; i++) { for (int j = 0; j < 4; j++) { - shape = n[j + i * 4]; - if (shape == 0) + tqshape = n[j + i * 4]; + if (tqshape == 0) { - p.fillRect(7 * (j-1), 7 * (i-1), 6, 6, Qt::red); + p.fillRect(7 * (j-1), 7 * (i-1), 6, 6, TQt::red); } - else if (shape != 5) + else if (tqshape != 5) { - if (shape == 1) p.translate(7 * (j-1), 7 * (i-1)); - else if (shape == 2) + if (tqshape == 1) p.translate(7 * (j-1), 7 * (i-1)); + else if (tqshape == 2) { p.translate(7 * j - 2, 7 * (i-1)); p.rotate(90); } - else if (shape == 3) + else if (tqshape == 3) { p.translate(7 * j - 2, 7 * i - 2); p.rotate(180); } - else if (shape == 4) + else if (tqshape == 4) { p.translate(7 * (j-1), 7 * i - 2); p.rotate(270); @@ -173,19 +173,19 @@ void number::paintDigit(TQPainter &p, int number) const p.drawPie(0, 0, 11, 11, 90 * 16, 16 * 90); - if (shape == 1) p.translate(-7 * (j-1), -7 * (i-1)); - else if (shape == 2) + if (tqshape == 1) p.translate(-7 * (j-1), -7 * (i-1)); + else if (tqshape == 2) { p.rotate(-90); p.translate(-(7 * j - 2), -7 * (i-1)); } - else if (shape == 3) + else if (tqshape == 3) { p.rotate(-180); p.translate(-(7 * j - 2), -(7 * i - 2)); } - else if (shape == 4) + else if (tqshape == 4) { p.rotate(-270); p.translate(- (7 * (j-1)), -(7 * i - 2)); -- cgit v1.2.3