summaryrefslogtreecommitdiffstats
path: root/kmahjongg/HighScore.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 /kmahjongg/HighScore.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 'kmahjongg/HighScore.cpp')
-rw-r--r--kmahjongg/HighScore.cpp112
1 files changed, 56 insertions, 56 deletions
diff --git a/kmahjongg/HighScore.cpp b/kmahjongg/HighScore.cpp
index 2e55c15a..f59e782b 100644
--- a/kmahjongg/HighScore.cpp
+++ b/kmahjongg/HighScore.cpp
@@ -3,20 +3,20 @@
#include "HighScore.moc"
-#include <qlabel.h>
-#include <qfileinfo.h>
+#include <tqlabel.h>
+#include <tqfileinfo.h>
#include <kmessagebox.h>
#include "klocale.h"
#include <kstandarddirs.h>
#include <kiconloader.h>
-#include <qlineedit.h>
-#include <qcombobox.h>
+#include <tqlineedit.h>
+#include <tqcombobox.h>
#include <kapplication.h>
#include <kpushbutton.h>
#include <kstdguiitem.h>
-static const QString highScoreMagic1_0 = "kmahjongg-scores-v1.0";
-static const QString highScoreMagic1_1 = "kmahjongg-scores-v1.1";
+static const TQString highScoreMagic1_0 = "kmahjongg-scores-v1.0";
+static const TQString highScoreMagic1_1 = "kmahjongg-scores-v1.1";
static const char * highScoreFilename = "/kmahjonggHiscores";
@@ -43,11 +43,11 @@ int defTimes[numScores] = {ages, ages-1, ages-2, ages-3,
HighScore::HighScore
(
- QWidget* parent,
+ TQWidget* parent,
const char* name
)
:
- QDialog( parent, name, true, 0 )
+ TQDialog( parent, name, true, 0 )
{
// form the target name
@@ -55,10 +55,10 @@ HighScore::HighScore
filename = locateLocal("appdata", highScoreFilename);
- QFont fnt;
+ TQFont fnt;
// Number
- QLabel* qtarch_Label_3;
- qtarch_Label_3 = new QLabel( this, "Label_3" );
+ TQLabel* qtarch_Label_3;
+ qtarch_Label_3 = new TQLabel( this, "Label_3" );
qtarch_Label_3->setGeometry( 10, 45, 30, 30 );
qtarch_Label_3->setFrameStyle( 50 );
qtarch_Label_3->setText( i18n("Pos") );
@@ -70,8 +70,8 @@ HighScore::HighScore
// name
- QLabel* qtarch_Label_4;
- qtarch_Label_4 = new QLabel( this, "Label_4" );
+ TQLabel* qtarch_Label_4;
+ qtarch_Label_4 = new TQLabel( this, "Label_4" );
qtarch_Label_4->setGeometry( 40, 45, 150, 30 );
qtarch_Label_4->setFrameStyle( 50 );
qtarch_Label_4->setText( i18n("Name") );
@@ -79,24 +79,24 @@ HighScore::HighScore
// board number
- QLabel* boardTitle;
- boardTitle= new QLabel( this, "" );
+ TQLabel* boardTitle;
+ boardTitle= new TQLabel( this, "" );
boardTitle->setGeometry( 190, 45, 80, 30 );
boardTitle->setFrameStyle( 50 );
boardTitle->setText( i18n("Board") );
boardTitle->setFont(fnt);
// score
- QLabel* qtarch_Label_5;
- qtarch_Label_5 = new QLabel( this, "Label_5" );
+ TQLabel* qtarch_Label_5;
+ qtarch_Label_5 = new TQLabel( this, "Label_5" );
qtarch_Label_5->setGeometry( 270, 45, 70, 30 );
qtarch_Label_5->setFrameStyle( 50 );
qtarch_Label_5->setText( i18n("Score") );
qtarch_Label_5->setFont(fnt);
// time
- QLabel* qtarch_Label_6;
- qtarch_Label_6 = new QLabel( this, "Label_6" );
+ TQLabel* qtarch_Label_6;
+ qtarch_Label_6 = new TQLabel( this, "Label_6" );
qtarch_Label_6->setGeometry( 340, 45, 70, 30 );
qtarch_Label_6->setFrameStyle( 50 );
qtarch_Label_6->setText( i18n("Time") );
@@ -107,22 +107,22 @@ HighScore::HighScore
for (int row=0; row<numScores; row++)
addRow(row);
- QPushButton* qtarch_PushButton_1;
+ TQPushButton* qtarch_PushButton_1;
qtarch_PushButton_1 = new KPushButton( KStdGuiItem::ok(), this, "PushButton_1" );
qtarch_PushButton_1->setGeometry( 110+35, 340+50, 100, 30 );
qtarch_PushButton_1->setMinimumSize( 0, 0 );
qtarch_PushButton_1->setMaximumSize( 32767, 32767 );
- qtarch_PushButton_1->setFocusPolicy( QWidget::TabFocus );
+ qtarch_PushButton_1->setFocusPolicy( TQWidget::TabFocus );
qtarch_PushButton_1->setAutoRepeat( false );
qtarch_PushButton_1->setAutoResize( false );
qtarch_PushButton_1->setDefault(true);
- QPushButton* resetBtn;
- resetBtn= new QPushButton( this, "resetBtn" );
+ TQPushButton* resetBtn;
+ resetBtn= new TQPushButton( this, "resetBtn" );
resetBtn->setGeometry( 10, 5, 25, 25);
resetBtn->setMinimumSize( 0, 0 );
resetBtn->setMaximumSize( 32767, 32767 );
- resetBtn->setFocusPolicy( QWidget::TabFocus );
+ resetBtn->setFocusPolicy( TQWidget::TabFocus );
//resetBtn->setText(i18n( "Reset" ));
resetBtn->setAutoRepeat( false );
resetBtn->setAutoResize( false );
@@ -136,23 +136,23 @@ HighScore::HighScore
/* off screen. it is moved over and placed in position when a */
/* new name is added */
- lineEdit = new QLineEdit(this, "");
+ lineEdit = new TQLineEdit(this, "");
lineEdit->setGeometry( 50, 40+(20*30), 190, 30 );
- lineEdit->setFocusPolicy(QWidget::StrongFocus);
+ lineEdit->setFocusPolicy(TQWidget::StrongFocus);
lineEdit->setFrame(true);
- lineEdit->setEchoMode(QLineEdit::Normal);
+ lineEdit->setEchoMode(TQLineEdit::Normal);
lineEdit->setText("");
// the drop down for the board names
- combo = new QComboBox( false, this, "combo" );
+ combo = new TQComboBox( false, this, "combo" );
combo->setGeometry( 65, 5, 220, 25 );
combo->setMinimumSize( 0, 0 );
combo->setMaximumSize( 32767, 32767 );
- combo->setFocusPolicy( QWidget::StrongFocus );
+ combo->setFocusPolicy( TQWidget::StrongFocus );
combo->setSizeLimit( 10 );
combo->setAutoResize( false );
- connect( combo, SIGNAL(activated(int)), SLOT(selectionChanged(int)) );
+ connect( combo, TQT_SIGNAL(activated(int)), TQT_SLOT(selectionChanged(int)) );
resize( 350+70,390+45 );
@@ -166,12 +166,12 @@ HighScore::HighScore
selectedLine = -1;
- connect(lineEdit, SIGNAL( textChanged(const QString &)),
- SLOT( nameChanged(const QString &)));
+ connect(lineEdit, TQT_SIGNAL( textChanged(const TQString &)),
+ TQT_SLOT( nameChanged(const TQString &)));
- connect(qtarch_PushButton_1, SIGNAL(clicked()), SLOT(reject()));
- connect(resetBtn, SIGNAL(clicked()), SLOT(reset()));
+ connect(qtarch_PushButton_1, TQT_SIGNAL(clicked()), TQT_SLOT(reject()));
+ connect(resetBtn, TQT_SIGNAL(clicked()), TQT_SLOT(reset()));
}
// free up the table structures
@@ -202,7 +202,7 @@ void HighScore::loadTables() {
char buff[1024];
// open the file, on error set up the default table
- FILE *fp = fopen( QFile::encodeName(highScoreFile()), "r");
+ FILE *fp = fopen( TQFile::encodeName(highScoreFile()), "r");
if (fp == NULL)
goto error;
@@ -235,7 +235,7 @@ void HighScore::loadTables() {
fgets(buff, sizeof(buff), fp);
if (buff[strlen(buff)-1] == '\n')
buff[strlen(buff)-1] = '\0';
- t->entries[e].name=QString::fromUtf8(buff,-1);
+ t->entries[e].name=TQString::fromUtf8(buff,-1);
}
}
@@ -261,7 +261,7 @@ void HighScore::saveTables() {
// open the outrput file, with naff error handling
- FILE *fp = fopen( QFile::encodeName(highScoreFile()), "w");
+ FILE *fp = fopen( TQFile::encodeName(highScoreFile()), "w");
if (fp == NULL)
return;
@@ -294,7 +294,7 @@ void HighScore::saveTables() {
// current table to the specified board. Create it if it does not
// exist.
-void HighScore::selectTable(const QString &board) {
+void HighScore::selectTable(const TQString &board) {
TableInstance *pos = tables;
@@ -335,10 +335,10 @@ void HighScore::selectTable(const QString &board) {
void HighScore::addRow(int num) {
- QFont tmp;
+ TQFont tmp;
// game number
- numbersWidgets[num] = new QLabel( this);
+ numbersWidgets[num] = new TQLabel( this);
numbersWidgets[num]->setGeometry( 10, 75+(num*30), 30, 30 );
numbersWidgets[num]->setFrameStyle( 50 );
numbersWidgets[num]->setAlignment( AlignRight | AlignVCenter );
@@ -346,19 +346,19 @@ void HighScore::addRow(int num) {
// name
- namesWidgets[num] = new QLabel( this);
+ namesWidgets[num] = new TQLabel( this);
namesWidgets[num]->setGeometry( 40, 75+(num*30), 150, 30 );
namesWidgets[num]->setFrameStyle( 50 );
namesWidgets[num]->setAlignment( 289 );
// board
- boardWidgets[num] = new QLabel( this);
+ boardWidgets[num] = new TQLabel( this);
boardWidgets[num]->setGeometry( 190, 75+(num*30), 80, 30 );
boardWidgets[num]->setFrameStyle( 50 );
boardWidgets[num]->setAlignment( 289 );
// score
- scoresWidgets[num] = new QLabel( this);
+ scoresWidgets[num] = new TQLabel( this);
scoresWidgets[num]->setGeometry( 270, 75+(num*30), 70, 30 );
scoresWidgets[num]->setFrameStyle( 50 );
tmp = scoresWidgets[num]->font();
@@ -366,7 +366,7 @@ void HighScore::addRow(int num) {
scoresWidgets[num]->setFont(tmp);
// elapsed time
- elapsedWidgets[num] = new QLabel( this);
+ elapsedWidgets[num] = new TQLabel( this);
elapsedWidgets[num]->setGeometry( 270+70, 75+(num*30), 70, 30 );
elapsedWidgets[num]->setFrameStyle( 50 );
tmp = elapsedWidgets[num]->font();
@@ -376,9 +376,9 @@ void HighScore::addRow(int num) {
}
-void HighScore::copyTableToScreen(const QString &name) {
+void HighScore::copyTableToScreen(const TQString &name) {
char buff[256];
- QString base;
+ TQString base;
getBoardName(name, base);
selectTable(base);
for (int p=0; p<numScores;p++) {
@@ -399,15 +399,15 @@ void HighScore::copyTableToScreen(const QString &name) {
repaint(false);
}
-int HighScore::exec(QString &layout) {
+int HighScore::exec(TQString &layout) {
copyTableToScreen(layout);
- return(QDialog::exec());
+ return(TQDialog::exec());
}
-void HighScore::checkHighScore(int s, int e, long gameNum, QString &name) {
+void HighScore::checkHighScore(int s, int e, long gameNum, TQString &name) {
int pos;
- QString board;
+ TQString board;
getBoardName(name, board);
// make this board name the current one!
@@ -455,7 +455,7 @@ void HighScore::checkHighScore(int s, int e, long gameNum, QString &name) {
}
-void HighScore::nameChanged(const QString &s) {
+void HighScore::nameChanged(const TQString &s) {
if (selectedLine == -1)
return;
@@ -468,13 +468,13 @@ void HighScore::nameChanged(const QString &s) {
}
-void HighScore::getBoardName(QString in, QString &out) {
+void HighScore::getBoardName(TQString in, TQString &out) {
- QFileInfo fi( in );
+ TQFileInfo fi( in );
out = fi.baseName();
}
-void HighScore::setComboTo(const QString &to) {
+void HighScore::setComboTo(const TQString &to) {
for (int p=0; p<combo->count(); p++) {
if (combo->text(p) == to)
combo->setCurrentItem(p);
@@ -504,7 +504,7 @@ void HighScore::reset() {
return ;
// delete the file
- res = unlink( QFile::encodeName(highScoreFile()));
+ res = unlink( TQFile::encodeName(highScoreFile()));
// wipe ou the in memory list of tables
TableInstance *t, *d;
@@ -535,7 +535,7 @@ void HighScore::reset() {
copyTableToScreen("default");
}
-QString &HighScore::highScoreFile() {
+TQString &HighScore::highScoreFile() {
return filename;
}