summaryrefslogtreecommitdiffstats
path: root/kbounce/kbounce.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
commit576eb4299a00bc053db35414406f46372a0f70f2 (patch)
tree4c030922d533821db464af566188e7d40cc8848c /kbounce/kbounce.cpp
parent0718336b6017d1a4fc1d626544180a5a2a29ddec (diff)
downloadtdegames-576eb4299a00bc053db35414406f46372a0f70f2.tar.gz
tdegames-576eb4299a00bc053db35414406f46372a0f70f2.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1157643 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbounce/kbounce.cpp')
-rw-r--r--kbounce/kbounce.cpp106
1 files changed, 53 insertions, 53 deletions
diff --git a/kbounce/kbounce.cpp b/kbounce/kbounce.cpp
index eab691b8..65fcaae9 100644
--- a/kbounce/kbounce.cpp
+++ b/kbounce/kbounce.cpp
@@ -16,13 +16,13 @@
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <qlayout.h>
+#include <tqlayout.h>
#include <klocale.h>
#include <kapplication.h>
#include <kaction.h>
#include <kstdgameaction.h>
-#include <qtimer.h>
-#include <qlcdnumber.h>
+#include <tqtimer.h>
+#include <tqlcdnumber.h>
#include <kmessagebox.h>
#include <kdebug.h>
#include <kfiledialog.h>
@@ -51,51 +51,51 @@ KJezzball::KJezzball()
m_soundAction -> setChecked((config->readBoolEntry( "PlaySounds", true )));
// create widgets
- m_view = new QWidget( this, "m_view" );
+ m_view = new TQWidget( this, "m_view" );
setCentralWidget( m_view );
- m_layout = new QGridLayout( m_view, 1, 3 );
+ m_layout = new TQGridLayout( m_view, 1, 3 );
m_layout->setColStretch( 2, 1 );
- QVBoxLayout *infoLayout = new QVBoxLayout;
+ TQVBoxLayout *infoLayout = new QVBoxLayout;
m_layout->addLayout( infoLayout, 0, 1 );
- QLabel *label = new QLabel( i18n("Level:"), m_view );
+ TQLabel *label = new TQLabel( i18n("Level:"), m_view );
infoLayout->addWidget( label );
- m_levelLCD = new QLCDNumber( 5, m_view );
+ m_levelLCD = new TQLCDNumber( 5, m_view );
infoLayout->addWidget( m_levelLCD );
- label = new QLabel( i18n("Score:"), m_view );
+ label = new TQLabel( i18n("Score:"), m_view );
infoLayout->addWidget( label );
- m_scoreLCD = new QLCDNumber( 5, m_view );
+ m_scoreLCD = new TQLCDNumber( 5, m_view );
infoLayout->addWidget( m_scoreLCD );
infoLayout->addSpacing( 20 );
- label = new QLabel( i18n("Filled area:"), m_view );
+ label = new TQLabel( i18n("Filled area:"), m_view );
infoLayout->addWidget( label );
- m_percentLCD = new QLCDNumber( 5, m_view );
+ m_percentLCD = new TQLCDNumber( 5, m_view );
infoLayout->addWidget( m_percentLCD );
- label = new QLabel( i18n("Lives:"), m_view );
+ label = new TQLabel( i18n("Lives:"), m_view );
infoLayout->addWidget( label );
- m_lifesLCD = new QLCDNumber( 5, m_view );
+ m_lifesLCD = new TQLCDNumber( 5, m_view );
infoLayout->addWidget( m_lifesLCD );
- label = new QLabel( i18n("Time:"), m_view );
+ label = new TQLabel( i18n("Time:"), m_view );
infoLayout->addWidget( label );
- m_timeLCD = new QLCDNumber( 5, m_view );
+ m_timeLCD = new TQLCDNumber( 5, m_view );
infoLayout->addWidget( m_timeLCD );
// create timers
- m_nextLevelTimer = new QTimer( this, "m_nextLevelTimer" );
- connect( m_nextLevelTimer, SIGNAL(timeout()), this, SLOT(switchLevel()) );
+ m_nextLevelTimer = new TQTimer( this, "m_nextLevelTimer" );
+ connect( m_nextLevelTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(switchLevel()) );
- m_gameOverTimer = new QTimer( this, "m_gameOverTimer" );
- connect( m_gameOverTimer, SIGNAL(timeout()), this, SLOT(gameOverNow()) );
+ m_gameOverTimer = new TQTimer( this, "m_gameOverTimer" );
+ connect( m_gameOverTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(gameOverNow()) );
- m_timer = new QTimer( this, "m_timer" );
- connect( m_timer, SIGNAL(timeout()), this, SLOT(second()) );
+ m_timer = new TQTimer( this, "m_timer" );
+ connect( m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(second()) );
// create demo game
createLevel( 1 );
@@ -103,7 +103,7 @@ KJezzball::KJezzball()
.arg(m_newAction->shortcut().toString()) );
//m_gameWidget->display( i18n("Press <Space> to start a game!") );
- setFocusPolicy(QWidget::StrongFocus);
+ setFocusPolicy(TQWidget::StrongFocus);
setFocus();
setupGUI();
}
@@ -119,23 +119,23 @@ KJezzball::~KJezzball()
*/
void KJezzball::initXMLUI()
{
- m_newAction = KStdGameAction::gameNew( this, SLOT(newGame()), actionCollection() );
+ m_newAction = KStdGameAction::gameNew( this, TQT_SLOT(newGame()), actionCollection() );
// AB: originally KBounce/KJezzball used Space for new game - but Ctrl+N is
// default. We solve this by providing space as an alternative key
KShortcut s = m_newAction->shortcut();
- s.append(KKeySequence(QKeySequence(Key_Space)));
+ s.append(KKeySequence(TQKeySequence(Key_Space)));
m_newAction->setShortcut(s);
- KStdGameAction::quit(this, SLOT(close()), actionCollection() );
- KStdGameAction::highscores(this, SLOT(showHighscore()), actionCollection() );
- m_pauseButton = KStdGameAction::pause(this, SLOT(pauseGame()), actionCollection());
- KStdGameAction::end(this, SLOT(closeGame()), actionCollection());
- KStdGameAction::configureHighscores(this, SLOT(configureHighscores()),actionCollection());
+ KStdGameAction::quit(this, TQT_SLOT(close()), actionCollection() );
+ KStdGameAction::highscores(this, TQT_SLOT(showHighscore()), actionCollection() );
+ m_pauseButton = KStdGameAction::pause(this, TQT_SLOT(pauseGame()), actionCollection());
+ KStdGameAction::end(this, TQT_SLOT(closeGame()), actionCollection());
+ KStdGameAction::configureHighscores(this, TQT_SLOT(configureHighscores()),actionCollection());
- new KAction( i18n("&Select Background Folder..."), 0, this, SLOT(selectBackground()),
+ new KAction( i18n("&Select Background Folder..."), 0, this, TQT_SLOT(selectBackground()),
actionCollection(), "background_select" );
m_backgroundShowAction =
- new KToggleAction( i18n("Show &Backgrounds"), 0, this, SLOT(showBackground()),
+ new KToggleAction( i18n("Show &Backgrounds"), 0, this, TQT_SLOT(showBackground()),
actionCollection(), "background_show" );
m_backgroundShowAction->setCheckedState(i18n("Hide &Backgrounds"));
m_backgroundShowAction->setEnabled( !m_backgroundDir.isEmpty() );
@@ -177,7 +177,7 @@ void KJezzball::closeGame()
int old_state = m_state;
if (old_state == Running)
pauseGame();
- int ret = KMessageBox::questionYesNo( this, i18n("Do you really want to close the running game?"), QString::null, KStdGuiItem::close(), KStdGuiItem::cancel() );
+ int ret = KMessageBox::questionYesNo( this, i18n("Do you really want to close the running game?"), TQString::null, KStdGuiItem::close(), KStdGuiItem::cancel() );
if ( ret==KMessageBox::Yes )
{
stopLevel();
@@ -206,7 +206,7 @@ void KJezzball::pauseGame()
case Suspend:
m_state = Running;
statusBar()->clear();
- //m_gameWidget->display( QString::null );
+ //m_gameWidget->display( TQString::null );
startLevel();
break;
@@ -226,7 +226,7 @@ void KJezzball::gameOverNow()
{
m_state = Idle;
- QString score;
+ TQString score;
score.setNum( m_game.score );
KMessageBox::information( this, i18n("Game Over! Score: %1").arg(score) );
statusBar()->message( i18n("Game over. Press <Space> for a new game") );
@@ -255,7 +255,7 @@ void KJezzball::showHighscore()
*/
void KJezzball::selectBackground()
{
- QString path = KFileDialog::getExistingDirectory( m_backgroundDir, this,
+ TQString path = KFileDialog::getExistingDirectory( m_backgroundDir, this,
i18n("Select Background Image Folder") );
if ( !path.isEmpty() && path!=m_backgroundDir ) {
m_backgroundDir = path;
@@ -299,33 +299,33 @@ void KJezzball::showBackground()
m_background = getBackgroundPixmap();
}
- m_gameWidget->setBackground( m_showBackground ? m_background : QPixmap() );
+ m_gameWidget->setBackground( m_showBackground ? m_background : TQPixmap() );
}
}
-QPixmap KJezzball::getBackgroundPixmap()
+TQPixmap KJezzball::getBackgroundPixmap()
{
// list directory
- QDir dir( m_backgroundDir, "*.png *.jpg", QDir::Name|QDir::IgnoreCase, QDir::Files );
+ TQDir dir( m_backgroundDir, "*.png *.jpg", TQDir::Name|TQDir::IgnoreCase, TQDir::Files );
if ( !dir.exists() ) {
kdDebug(12008) << "Directory not found" << endl;
- return QPixmap();
+ return TQPixmap();
}
if (dir.count() > 1)
{
// return random pixmap
int num = kapp->random() % dir.count();
- return QPixmap( dir.absFilePath( dir[num] ) );
+ return TQPixmap( dir.absFilePath( dir[num] ) );
}
else if (dir.count()==1)
{
- return QPixmap( dir.absFilePath(dir[0]) );
+ return TQPixmap( dir.absFilePath(dir[0]) );
}
- else return QPixmap();
+ else return TQPixmap();
}
-void KJezzball::focusOutEvent( QFocusEvent *ev )
+void KJezzball::focusOutEvent( TQFocusEvent *ev )
{
if ( m_state==Running )
{
@@ -339,7 +339,7 @@ void KJezzball::focusOutEvent( QFocusEvent *ev )
KMainWindow::focusOutEvent( ev );
}
-void KJezzball::focusInEvent ( QFocusEvent *ev )
+void KJezzball::focusInEvent ( TQFocusEvent *ev )
{
if ( m_state==Suspend )
{
@@ -347,7 +347,7 @@ void KJezzball::focusInEvent ( QFocusEvent *ev )
m_state = Running;
statusBar()->clear();
m_pauseButton->setChecked(false);
- //m_gameWidget->display( QString::null );
+ //m_gameWidget->display( TQString::null );
}
KMainWindow::focusInEvent( ev );
@@ -393,16 +393,16 @@ void KJezzball::createLevel( int level )
if ( m_showBackground )
m_background = getBackgroundPixmap();
else
- m_background = QPixmap();
+ m_background = TQPixmap();
m_gameWidget = new JezzGame( m_background, level+1, m_view, "m_gameWidget" );
m_gameWidget->setSound(m_soundAction->isChecked());
m_gameWidget->show();
m_layout->addWidget( m_gameWidget, 0, 0 );
- connect( m_gameWidget, SIGNAL(died()), this, SLOT(died()) );
- connect( m_gameWidget, SIGNAL(newPercent(int)), this, SLOT(newPercent(int)) );
- connect( m_soundAction, SIGNAL(toggled(bool)), m_gameWidget, SLOT(setSound(bool)) );
+ connect( m_gameWidget, TQT_SIGNAL(died()), this, TQT_SLOT(died()) );
+ connect( m_gameWidget, TQT_SIGNAL(newPercent(int)), this, TQT_SLOT(newPercent(int)) );
+ connect( m_soundAction, TQT_SIGNAL(toggled(bool)), m_gameWidget, TQT_SLOT(setSound(bool)) );
// update displays
m_level.lifes = level+1;
@@ -453,13 +453,13 @@ void KJezzball::switchLevel()
m_scoreLCD->setNumDigits( numDigits );
m_scoreLCD->display( m_game.score );
- QString score;
+ TQString score;
score.setNum( m_level.score );
- QString level;
+ TQString level;
level.setNum( m_game.level );
-QString foo = QString(
+TQString foo = TQString(
i18n("You have successfully cleared more than 75% of the board.\n") +
i18n("%1 points: 15 points per remaining life\n").arg(m_level.lifes*15) +
i18n("%1 points: Bonus\n").arg((m_gameWidget->percent()-75)*2*(m_game.level+5)) +