summaryrefslogtreecommitdiffstats
path: root/kgoldrunner/src/kgrdialog.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
commit838baf3f99ec5ab81b063eb5449a3381d860f377 (patch)
treedd31abcfde08ca92e4623b8f50b3d762a87c997a /kgoldrunner/src/kgrdialog.cpp
parent2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff)
downloadtdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.tar.gz
tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.zip
TQt4 port kdegames
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1236074 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kgoldrunner/src/kgrdialog.cpp')
-rw-r--r--kgoldrunner/src/kgrdialog.cpp138
1 files changed, 69 insertions, 69 deletions
diff --git a/kgoldrunner/src/kgrdialog.cpp b/kgoldrunner/src/kgrdialog.cpp
index 632eb617..011f56dc 100644
--- a/kgoldrunner/src/kgrdialog.cpp
+++ b/kgoldrunner/src/kgrdialog.cpp
@@ -29,16 +29,16 @@
#ifdef KGR_PORTABLE
KGrSLDialog::KGrSLDialog (int action, int requestedLevel, int collnIndex,
TQPtrList<KGrCollection> & gamesList, KGrGame * theGame,
- TQWidget * parent, const char * name)
- : TQDialog (parent, name, TRUE,
+ TQWidget * tqparent, const char * name)
+ : TQDialog (tqparent, name, TRUE,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title)
#else
KGrSLDialog::KGrSLDialog (int action, int requestedLevel, int collnIndex,
TQPtrList<KGrCollection> & gamesList, KGrGame * theGame,
- TQWidget * parent, const char * name)
+ TQWidget * tqparent, const char * name)
: KDialogBase (KDialogBase::Plain, i18n("Select Game"),
KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Help,
- KDialogBase::Ok, parent, name)
+ KDialogBase::Ok, tqparent, name)
#endif
{
slAction = action;
@@ -47,7 +47,7 @@ KGrSLDialog::KGrSLDialog (int action, int requestedLevel, int collnIndex,
collections = gamesList;
game = theGame;
collection = collections.at(defaultGame);
- slParent = parent;
+ slParent = tqparent;
#ifdef KGR_PORTABLE
int margin = 10;
@@ -84,7 +84,7 @@ KGrSLDialog::KGrSLDialog (int action, int requestedLevel, int collnIndex,
if ((action == SL_START) || (action == SL_UPD_GAME)) {
dad-> setCaption (i18n("Select Game"));
- TQLabel * startMsg = new QLabel
+ TQLabel * startMsg = new TQLabel
("<b>" + i18n("Level 1 of the selected game is:") + "</b>", dad);
mainLayout->addWidget (startMsg);
}
@@ -99,7 +99,7 @@ KGrSLDialog::KGrSLDialog (int action, int requestedLevel, int collnIndex,
// Initial range 1->150, small step 1, big step 10 and default value 1.
number = new TQScrollBar (1, 150, 1, 10, 1,
- TQScrollBar::Horizontal, dad);
+ Qt::Horizontal, dad);
grid->addWidget (number, 1, 1);
TQHBox * numberPair = new TQHBox (dad);
@@ -117,7 +117,7 @@ KGrSLDialog::KGrSLDialog (int action, int requestedLevel, int collnIndex,
grid->addMultiCellWidget (thumbNail, 1, 3, 2, 2);
// Set thumbnail cell size to about 1/5 of game cell size.
- int cellSize = parent->width() / (5 * (FIELDWIDTH + 4));
+ int cellSize = tqparent->width() / (5 * (FIELDWIDTH + 4));
thumbNail-> setFixedWidth ((FIELDWIDTH * cellSize) + 2);
thumbNail-> setFixedHeight ((FIELDHEIGHT * cellSize) + 2);
@@ -125,15 +125,15 @@ KGrSLDialog::KGrSLDialog (int action, int requestedLevel, int collnIndex,
TQHBox * buttons = new TQHBox (this);
mainLayout->addWidget (buttons);
buttons->setSpacing (spacing);
- // Buttons are for Qt-only portability. NOT COMPILED in KDE environment.
+ // Buttons are for TQt-only portability. NOT COMPILED in KDE environment.
HELP = new TQPushButton (i18n("Help"), buttons);
OK = new TQPushButton (i18n("&OK"), buttons);
CANCEL = new TQPushButton (i18n("&Cancel"), buttons);
- TQPoint p = parent->mapToGlobal (TQPoint (0,0));
+ TQPoint p = tqparent->mapToGlobal (TQPoint (0,0));
- // Base the geometry of the dialog box on the playing area.
- int cell = parent->width() / (FIELDWIDTH + 4);
+ // Base the tqgeometry of the dialog box on the playing area.
+ int cell = tqparent->width() / (FIELDWIDTH + 4);
dad-> move (p.x()+2*cell, p.y()+2*cell);
dad-> setMinimumSize ((FIELDWIDTH*cell/2), (FIELDHEIGHT-1)*cell);
@@ -357,7 +357,7 @@ void KGrSLDialog::slAboutColln ()
{
// User clicked the "About" button ...
int n = slCollnIndex;
- QString title = i18n("About \"%1\"").arg(collections.at(n)->name);
+ TQString title = i18n("About \"%1\"").tqarg(collections.at(n)->name);
if (collections.at(n)->about.length() > 0) {
// Convert game description to ASCII and UTF-8 codes, then translate it.
@@ -401,10 +401,10 @@ void KGrSLDialog::slPaintLevel ()
if (n < 0) {
return; // Owner has no collections.
}
- QString filePath = game->getFilePath
+ TQString filePath = game->getFilePath
(collections.at(n)->owner, collections.at(n), number->value());
thumbNail->setFilePath (filePath, slName);
- thumbNail->repaint(); // Will call "drawContents (p)".
+ thumbNail->tqrepaint(); // Will call "drawContents (p)".
}
void KGrSLDialog::slotHelp ()
@@ -486,15 +486,15 @@ void KGrSLDialog::slotHelp ()
#ifdef KGR_PORTABLE
KGrNHDialog::KGrNHDialog(const TQString & levelName, const TQString & levelHint,
- TQWidget * parent, const char * name)
- : TQDialog (parent, name, TRUE,
+ TQWidget * tqparent, const char * name)
+ : TQDialog (tqparent, name, TRUE,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title)
#else
KGrNHDialog::KGrNHDialog(const TQString & levelName, const TQString & levelHint,
- TQWidget * parent, const char * name)
+ TQWidget * tqparent, const char * name)
: KDialogBase (KDialogBase::Plain, i18n("Edit Name & Hint"),
KDialogBase::Ok | KDialogBase::Cancel,
- KDialogBase::Ok, parent, name)
+ KDialogBase::Ok, tqparent, name)
#endif
{
#ifdef KGR_PORTABLE
@@ -530,21 +530,21 @@ KGrNHDialog::KGrNHDialog(const TQString & levelName, const TQString & levelHint,
TQHBox * buttons = new TQHBox (dad);
mainLayout->addWidget (buttons);
buttons->setSpacing (spacing);
- // Buttons are for Qt-only portability. NOT COMPILED in KDE environment.
+ // Buttons are for TQt-only portability. NOT COMPILED in KDE environment.
TQPushButton * OK = new TQPushButton (i18n("&OK"), buttons);
TQPushButton * CANCEL = new TQPushButton (i18n("&Cancel"), buttons);
dad-> setCaption (i18n("Edit Name & Hint"));
#endif
- // Base the geometry of the text box on the playing area.
- QPoint p = parent->mapToGlobal (TQPoint (0,0));
- int c = parent->width() / (FIELDWIDTH + 4);
+ // Base the tqgeometry of the text box on the playing area.
+ TQPoint p = tqparent->mapToGlobal (TQPoint (0,0));
+ int c = tqparent->width() / (FIELDWIDTH + 4);
dad-> move (p.x()+4*c, p.y()+4*c);
mle-> setMinimumSize ((FIELDWIDTH*c/2), (FIELDHEIGHT/2)*c);
// Configure the text box.
- mle-> setAlignment (AlignLeft);
+ mle-> tqsetAlignment (AlignLeft);
#ifndef QT3
mle-> setWordWrap (TQMultiLineEdit::WidgetWidth);
mle-> setFixedVisibleLines (9);
@@ -573,16 +573,16 @@ KGrNHDialog::~KGrNHDialog()
#ifdef KGR_PORTABLE
KGrECDialog::KGrECDialog (int action, int collnIndex,
TQPtrList<KGrCollection> & gamesList,
- TQWidget * parent, const char * name)
- : TQDialog (parent, name, TRUE,
+ TQWidget * tqparent, const char * name)
+ : TQDialog (tqparent, name, TRUE,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title)
#else
KGrECDialog::KGrECDialog (int action, int collnIndex,
TQPtrList<KGrCollection> & gamesList,
- TQWidget * parent, const char * name)
+ TQWidget * tqparent, const char * name)
: KDialogBase (KDialogBase::Plain, i18n("Edit Game Info"),
KDialogBase::Ok | KDialogBase::Cancel,
- KDialogBase::Ok, parent, name)
+ KDialogBase::Ok, tqparent, name)
#endif
{
collections = gamesList;
@@ -612,7 +612,7 @@ KGrECDialog::KGrECDialog (int action, int collnIndex,
prefixL = new TQLabel (i18n("File name prefix:"), prefixBox);
ecPrefix = new TQLineEdit (prefixBox);
- ecGrp = new TQButtonGroup (1, TQButtonGroup::Horizontal, 0, dad);
+ ecGrp = new TQButtonGroup (1, Qt::Horizontal, 0, dad);
mainLayout->addWidget (ecGrp);
ecTradB = new TQRadioButton (i18n("Traditional rules"), ecGrp);
ecKGrB = new TQRadioButton (i18n("KGoldrunner rules"), ecGrp);
@@ -636,14 +636,14 @@ KGrECDialog::KGrECDialog (int action, int collnIndex,
TQHBox * buttons = new TQHBox (dad);
mainLayout->addWidget (buttons);
buttons->setSpacing (spacing);
- // Buttons are for Qt-only portability. NOT COMPILED in KDE environment.
+ // Buttons are for TQt-only portability. NOT COMPILED in KDE environment.
OK = new TQPushButton (i18n("&OK"), buttons);
CANCEL = new TQPushButton (i18n("&Cancel"), buttons);
- TQPoint p = parent->mapToGlobal (TQPoint (0,0));
+ TQPoint p = tqparent->mapToGlobal (TQPoint (0,0));
- // Base the geometry of the dialog box on the playing area.
- int cell = parent->width() / (FIELDWIDTH + 4);
+ // Base the tqgeometry of the dialog box on the playing area.
+ int cell = tqparent->width() / (FIELDWIDTH + 4);
dad-> move (p.x()+2*cell, p.y()+2*cell);
dad-> setMinimumSize ((FIELDWIDTH*cell/2), (FIELDHEIGHT-1)*cell);
#endif
@@ -663,13 +663,13 @@ KGrECDialog::KGrECDialog (int action, int collnIndex,
// Collection already has some levels, so cannot change the prefix.
ecPrefix-> setEnabled (FALSE);
}
- QString s;
+ TQString s;
#ifndef KGR_PORTABLE
nLevL-> setText (i18n("1 level", "%n levels",
collections.at(defaultGame)->nLevels));
#else
nLevL-> setText (i18n("%1 levels")
- .arg(collections.at(defaultGame)->nLevels));
+ .tqarg(collections.at(defaultGame)->nLevels));
#endif
OKText = i18n("Save Changes");
}
@@ -694,7 +694,7 @@ KGrECDialog::KGrECDialog (int action, int collnIndex,
}
// Configure the edit box.
- mle-> setAlignment (AlignLeft);
+ mle-> tqsetAlignment (AlignLeft);
#ifndef QT3
mle-> setWordWrap (TQMultiLineEdit::WidgetWidth);
mle-> setFixedVisibleLines (8);
@@ -750,16 +750,16 @@ void KGrECDialog::ecSetTrad () {ecSetRules ('T');}
#ifdef KGR_PORTABLE
KGrLGDialog::KGrLGDialog (TQFile * savedGames,
TQPtrList<KGrCollection> & collections,
- TQWidget * parent, const char * name)
- : TQDialog (parent, name, TRUE,
+ TQWidget * tqparent, const char * name)
+ : TQDialog (tqparent, name, TRUE,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title)
#else
KGrLGDialog::KGrLGDialog (TQFile * savedGames,
TQPtrList<KGrCollection> & collections,
- TQWidget * parent, const char * name)
+ TQWidget * tqparent, const char * name)
: KDialogBase (KDialogBase::Plain, i18n("Select Saved Game"),
KDialogBase::Ok | KDialogBase::Cancel,
- KDialogBase::Ok, parent, name)
+ KDialogBase::Ok, tqparent, name)
#endif
{
#ifdef KGR_PORTABLE
@@ -780,9 +780,9 @@ KGrLGDialog::KGrLGDialog (TQFile * savedGames,
lgList = new TQListBox (dad);
#ifdef KGR_PORTABLE
- QFont f ("courier", 12);
+ TQFont f ("courier", 12);
#else
- QFont f = KGlobalSettings::fixedFont(); // KDE version.
+ TQFont f = KGlobalSettings::fixedFont(); // KDE version.
#endif
f.setFixedPitch (TRUE);
lgList-> setFont (f);
@@ -795,16 +795,16 @@ KGrLGDialog::KGrLGDialog (TQFile * savedGames,
#ifdef KGR_PORTABLE
TQHBox * buttons = new TQHBox (dad);
buttons-> setSpacing (spacing);
- // Buttons are for Qt-only portability. NOT COMPILED in KDE environment.
+ // Buttons are for TQt-only portability. NOT COMPILED in KDE environment.
TQPushButton * OK = new TQPushButton (i18n("&OK"), buttons);
TQPushButton * CANCEL = new TQPushButton (i18n("&Cancel"), buttons);
mainLayout-> addWidget (buttons);
dad-> setCaption (i18n("Select Saved Game"));
- // Base the geometry of the list box on the playing area.
- QPoint p = parent->mapToGlobal (TQPoint (0,0));
- int c = parent->width() / (FIELDWIDTH + 4);
+ // Base the tqgeometry of the list box on the playing area.
+ TQPoint p = tqparent->mapToGlobal (TQPoint (0,0));
+ int c = tqparent->width() / (FIELDWIDTH + 4);
dad-> move (p.x()+2*c, p.y()+2*c);
lgList-> setMinimumHeight ((FIELDHEIGHT/2)*c);
OK-> setMaximumWidth (4*c);
@@ -816,16 +816,16 @@ KGrLGDialog::KGrLGDialog (TQFile * savedGames,
lgHighlight = -1;
- QTextStream gameText (savedGames);
- QString s = "";
- QString pr = "";
+ TQTextStream gameText (savedGames);
+ TQString s = "";
+ TQString pr = "";
int i;
int imax = collections.count();
// Read the saved games into the list box.
while (! gameText.endData()) {
s = gameText.readLine(); // Read in one saved game.
- pr = s.left (s.find (" ", 0, FALSE)); // Get the collection prefix.
+ pr = s.left (s.tqfind (" ", 0, FALSE)); // Get the collection prefix.
for (i = 0; i < imax; i++) { // Get the collection name.
if (collections.at(i)->prefix == pr) {
s = s.insert (0,
@@ -858,26 +858,26 @@ void KGrLGDialog::lgSelect (int n)
*********************** CENTRALISED MESSAGE FUNCTIONS ************************
*******************************************************************************/
-void KGrMessage::information (TQWidget * parent, const TQString &caption, const TQString &text)
+void KGrMessage::information (TQWidget * tqparent, const TQString &caption, const TQString &text)
{
#ifdef KGR_PORTABLE
- // Force Qt to do word-wrapping (but it ignores "\n" line-breaks).
- TQMessageBox::information (parent, caption,
+ // Force TQt to do word-wrapping (but it ignores "\n" line-breaks).
+ TQMessageBox::information (tqparent, caption,
"<qt>" + text + "</qt>");
#else
// KDE does word-wrapping and will observe "\n" line-breaks.
- KMessageBox::information (parent, text, caption);
+ KMessageBox::information (tqparent, text, caption);
#endif
}
-int KGrMessage::warning (TQWidget * parent, TQString caption, TQString text,
+int KGrMessage::warning (TQWidget * tqparent, TQString caption, TQString text,
TQString label0, TQString label1, TQString label2)
{
int ans = 0;
#ifdef KGR_PORTABLE
// Display a box with 2 or 3 buttons, depending on if label2 is empty or not.
- // Force Qt to do word-wrapping (but it ignores "\n" line-breaks).
- ans = TQMessageBox::warning (parent, caption,
+ // Force TQt to do word-wrapping (but it ignores "\n" line-breaks).
+ ans = TQMessageBox::warning (tqparent, caption,
"<qt>" + text + "</qt>",
label0, label1, label2,
0, (label2.isEmpty()) ? 1 : 2);
@@ -885,13 +885,13 @@ int KGrMessage::warning (TQWidget * parent, TQString caption, TQString text,
// KDE does word-wrapping and will observe "\n" line-breaks.
if (label2.isEmpty()) {
// Display a box with 2 buttons.
- ans = KMessageBox::questionYesNo (parent, text, caption,
+ ans = KMessageBox::questionYesNo (tqparent, text, caption,
label0, label1);
ans = (ans == KMessageBox::Yes) ? 0 : 1;
}
else {
// Display a box with 3 buttons.
- ans = KMessageBox::questionYesNoCancel (parent, text, caption,
+ ans = KMessageBox::questionYesNoCancel (tqparent, text, caption,
label0, label1);
if (ans == KMessageBox::Cancel)
ans = 2;
@@ -906,12 +906,12 @@ int KGrMessage::warning (TQWidget * parent, TQString caption, TQString text,
/********************** WORD-WRAPPED MESSAGE BOX ************************/
/******************************************************************************/
-void KGrMessage::wrapped (TQWidget * parent, TQString title, TQString contents)
+void KGrMessage::wrapped (TQWidget * tqparent, TQString title, TQString contents)
{
#ifndef KGR_PORTABLE
- KMessageBox::information (parent, contents, title);
+ KMessageBox::information (tqparent, contents, title);
#else
- TQDialog * mm = new TQDialog (parent, "wrappedMessage", TRUE,
+ TQDialog * mm = new TQDialog (tqparent, "wrappedMessage", TRUE,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title);
int margin = 10;
@@ -919,7 +919,7 @@ void KGrMessage::wrapped (TQWidget * parent, TQString title, TQString contents)
TQVBoxLayout * mainLayout = new TQVBoxLayout (mm, margin, spacing);
// Make text background grey not white (i.e. same as widget background).
- QPalette pl = mm->palette();
+ TQPalette pl = mm->palette();
#ifdef QT3
pl.setColor (TQColorGroup::Base, mm->paletteBackgroundColor());
#else
@@ -936,21 +936,21 @@ void KGrMessage::wrapped (TQWidget * parent, TQString title, TQString contents)
#endif
mainLayout->addWidget (mle);
- // Button is for Qt-only portability. NOT COMPILED in KDE environment.
+ // Button is for TQt-only portability. NOT COMPILED in KDE environment.
TQPushButton * OK = new TQPushButton (i18n("&OK"), mm);
- mainLayout->addWidget (OK, Qt::AlignHCenter);
+ mainLayout->addWidget (OK, TQt::AlignHCenter);
mm-> setCaption (title);
- // Base the geometry of the text box on the playing area.
- QPoint p = parent->mapToGlobal (TQPoint (0,0));
- int c = parent->width() / (FIELDWIDTH + 4);
+ // Base the tqgeometry of the text box on the playing area.
+ TQPoint p = tqparent->mapToGlobal (TQPoint (0,0));
+ int c = tqparent->width() / (FIELDWIDTH + 4);
mm-> move (p.x()+4*c, p.y()+4*c);
mle-> setMinimumSize ((FIELDWIDTH*c/2), (FIELDHEIGHT/2)*c);
OK-> setMaximumWidth (3*c);
mle-> setFrameStyle (TQFrame::NoFrame);
- mle-> setAlignment (AlignLeft);
+ mle-> tqsetAlignment (AlignLeft);
mle-> setReadOnly (TRUE);
mle-> setText (contents);