summaryrefslogtreecommitdiffstats
path: root/kbackgammon/kbg.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 /kbackgammon/kbg.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 'kbackgammon/kbg.cpp')
-rw-r--r--kbackgammon/kbg.cpp184
1 files changed, 92 insertions, 92 deletions
diff --git a/kbackgammon/kbg.cpp b/kbackgammon/kbg.cpp
index 55aef32a..711471ad 100644
--- a/kbackgammon/kbg.cpp
+++ b/kbackgammon/kbg.cpp
@@ -24,16 +24,16 @@
#include "kbg.h"
#include "kbg.moc"
-#include <qpainter.h>
-#include <qlayout.h>
-#include <qgroupbox.h>
-#include <qpixmap.h>
-#include <qstring.h>
-#include <qwhatsthis.h>
-#include <qstringlist.h>
-#include <qvaluelist.h>
-#include <qiconset.h>
-#include <qvbox.h>
+#include <tqpainter.h>
+#include <tqlayout.h>
+#include <tqgroupbox.h>
+#include <tqpixmap.h>
+#include <tqstring.h>
+#include <tqwhatsthis.h>
+#include <tqstringlist.h>
+#include <tqvaluelist.h>
+#include <tqiconset.h>
+#include <tqvbox.h>
#include <kmenubar.h>
#include <ktoolbar.h>
@@ -89,7 +89,7 @@ KBg::KBg()
/*
* The main view is shared between the board and a small text window
*/
- panner = new QSplitter(Vertical, this, "panner");
+ panner = new TQSplitter(Vertical, this, "panner");
board = new KBgBoardSetup(panner, "board");
status = new KBgTextView(panner, "status");
setCentralWidget(panner);
@@ -97,59 +97,59 @@ KBg::KBg()
/*
* Create all actions needed by the application
*/
- newAction = KStdGameAction::gameNew(this, SLOT(openNew()), actionCollection());
+ newAction = KStdGameAction::gameNew(this, TQT_SLOT(openNew()), actionCollection());
newAction->setEnabled(false);
- KStdGameAction::print(this, SLOT(print()), actionCollection());
- KStdGameAction::quit(this, SLOT(close()), actionCollection());
+ KStdGameAction::print(this, TQT_SLOT(print()), actionCollection());
+ KStdGameAction::quit(this, TQT_SLOT(close()), actionCollection());
- QStringList list;
+ TQStringList list;
for (int i = 0; i < MaxEngine; i++)
list.append(engineString[i]);
- engineSet = new KSelectAction(i18n("&Engine"), 0, this, SLOT(setupEngine()), actionCollection(),
+ engineSet = new KSelectAction(i18n("&Engine"), 0, this, TQT_SLOT(setupEngine()), actionCollection(),
"move_engine");
engineSet->setItems(list);
// AB: what the heck has this to do with redisplay? perhaps use reload instead?
- loadAction = KStdAction::redisplay(this, SLOT(load()), actionCollection(), "move_load");
+ loadAction = KStdAction::redisplay(this, TQT_SLOT(load()), actionCollection(), "move_load");
loadAction->setEnabled(false);
- undoAction = KStdGameAction::undo(this, SLOT(undo()), actionCollection());
+ undoAction = KStdGameAction::undo(this, TQT_SLOT(undo()), actionCollection());
undoAction->setEnabled(false);
- redoAction = KStdGameAction::redo(this, SLOT(redo()), actionCollection());
+ redoAction = KStdGameAction::redo(this, TQT_SLOT(redo()), actionCollection());
redoAction->setEnabled(false);
- rollAction = KStdGameAction::roll(this, SLOT(roll()), actionCollection());
+ rollAction = KStdGameAction::roll(this, TQT_SLOT(roll()), actionCollection());
rollAction->setEnabled(false);
- endAction = KStdGameAction::endTurn(this, SLOT(done()), actionCollection());
+ endAction = KStdGameAction::endTurn(this, TQT_SLOT(done()), actionCollection());
endAction->setEnabled(false);
- cubeAction = new KAction(i18n("Double Cube"), QIconSet(kapp->iconLoader()->loadIcon
+ cubeAction = new KAction(i18n("Double Cube"), TQIconSet(kapp->iconLoader()->loadIcon
(PROG_NAME "-double.xpm", KIcon::Toolbar)),
- 0, this, SLOT(cube()), actionCollection(), "move_cube");
+ 0, this, TQT_SLOT(cube()), actionCollection(), "move_cube");
cubeAction->setEnabled(false);
- KStdAction::showMenubar(this, SLOT(toggleMenubar()), actionCollection());
- KStdAction::preferences(this, SLOT(setupDlg()), actionCollection());
- KStdAction::saveOptions(this, SLOT(saveConfig()), actionCollection());
+ KStdAction::showMenubar(this, TQT_SLOT(toggleMenubar()), actionCollection());
+ KStdAction::preferences(this, TQT_SLOT(setupDlg()), actionCollection());
+ KStdAction::saveOptions(this, TQT_SLOT(saveConfig()), actionCollection());
KPopupMenu *p = (new KActionMenu(i18n("&Backgammon on the Web"),
actionCollection(), "help_www"))->popupMenu();
- (new KAction(helpTopic[FIBSHome][0], 0, this, SLOT(wwwFIBS()),
+ (new KAction(helpTopic[FIBSHome][0], 0, this, TQT_SLOT(wwwFIBS()),
actionCollection(), "help_www_fibs"))->plug(p);
- (new KAction(helpTopic[RuleHome][0], 0, this, SLOT(wwwRule()),
+ (new KAction(helpTopic[RuleHome][0], 0, this, TQT_SLOT(wwwRule()),
actionCollection(), "help_www_rule"))->plug(p);
/*
* Set up the command line - using actions, otherwise recreating the GUI will delete them
* (e.g. using KEditToolbar)
*/
- cmdLabel = new QLabel(i18n("Command: "), this);
+ cmdLabel = new TQLabel(i18n("Command: "), this);
new KWidgetAction( cmdLabel, cmdLabel->text(), 0, 0, 0, actionCollection(), "command_label");
cmdLine = new KLineEdit(this, "commandline");
- KWidgetAction* actionCmdLine = new KWidgetAction( cmdLine, QString::null, 0, 0, 0, actionCollection(), "command_lineedit");
+ KWidgetAction* actionCmdLine = new KWidgetAction( cmdLine, TQString::null, 0, 0, 0, actionCollection(), "command_lineedit");
actionCmdLine->setAutoSized(true);
cmdLine->completionObject()->setOrder(KCompletion::Weighted);
- connect(cmdLine, SIGNAL(returnPressed(const QString &)), this, SLOT(handleCmd(const QString &)));
+ connect(cmdLine, TQT_SIGNAL(returnPressed(const TQString &)), this, TQT_SLOT(handleCmd(const TQString &)));
/*
* Done with the actions, create the XML-defined parts of the
* user interface
@@ -173,33 +173,33 @@ KBg::KBg()
* Set up configuration handling.
* FIXME: support session management
*/
- connect(this, SIGNAL(readSettings()), board, SLOT(readConfig()));
- connect(this, SIGNAL(saveSettings()), board, SLOT(saveConfig()));
+ connect(this, TQT_SIGNAL(readSettings()), board, TQT_SLOT(readConfig()));
+ connect(this, TQT_SIGNAL(saveSettings()), board, TQT_SLOT(saveConfig()));
/*
* Set up some whatis messages for the online help
*/
- QWhatsThis::add(status, i18n("This area contains the status messages for the game. "
+ TQWhatsThis::add(status, i18n("This area contains the status messages for the game. "
"Most of these messages are sent to you from the current "
"engine."));
- QWhatsThis::add(toolBar("cmdToolBar"),
+ TQWhatsThis::add(toolBar("cmdToolBar"),
i18n("This is the command line. You can type special "
"commands related to the current engine in here. "
"Most relevant commands are also available "
"through the menus."));
- QWhatsThis::add(toolBar("mainToolBar"),
+ TQWhatsThis::add(toolBar("mainToolBar"),
i18n("This is the button bar tool bar. It gives "
"you easy access to game related commands. "
"You can drag the bar to a different location "
"within the window."));
- QWhatsThis::add(statusBar(),
+ TQWhatsThis::add(statusBar(),
i18n("This is the status bar. It shows you the currently "
"selected engine in the left corner."));
/*
* Create and initialize the context menu
*/
- QPopupMenu* menu = (QPopupMenu*)factory()->container("popup", this);
+ TQPopupMenu* menu = (TQPopupMenu*)factory()->container("popup", this);
board->setContextMenu(menu);
}
@@ -239,8 +239,8 @@ void KBg::setupEngine()
/*
* Remove the old engine, create a new one, and hook up menu and slots/signals
*/
- QPopupMenu *commandMenu = (QPopupMenu *)factory()->container("command_menu", this);
- QString s = PROG_NAME;
+ TQPopupMenu *commandMenu = (TQPopupMenu *)factory()->container("command_menu", this);
+ TQString s = PROG_NAME;
commandMenu->clear();
if (currEngine != None) {
@@ -275,26 +275,26 @@ void KBg::setupEngine()
newAction->setEnabled(engine[currEngine]->haveNewGame());
// engine -> this
- connect(engine[currEngine], SIGNAL(statText(const QString &)), this, SLOT(updateCaption(const QString &)));
- connect(engine[currEngine], SIGNAL(infoText(const QString &)), status, SLOT(write(const QString &)));
- connect(engine[currEngine], SIGNAL(allowCommand(int, bool)), this, SLOT(allowCommand(int, bool)));
+ connect(engine[currEngine], TQT_SIGNAL(statText(const TQString &)), this, TQT_SLOT(updateCaption(const TQString &)));
+ connect(engine[currEngine], TQT_SIGNAL(infoText(const TQString &)), status, TQT_SLOT(write(const TQString &)));
+ connect(engine[currEngine], TQT_SIGNAL(allowCommand(int, bool)), this, TQT_SLOT(allowCommand(int, bool)));
// this -> engine
- connect(this, SIGNAL(readSettings()), engine[currEngine], SLOT(readConfig()));
- connect(this, SIGNAL(saveSettings()), engine[currEngine], SLOT(saveConfig()));
+ connect(this, TQT_SIGNAL(readSettings()), engine[currEngine], TQT_SLOT(readConfig()));
+ connect(this, TQT_SIGNAL(saveSettings()), engine[currEngine], TQT_SLOT(saveConfig()));
// board -> engine
- connect(board, SIGNAL(rollDice(const int)), engine[currEngine], SLOT(rollDice(const int)));
- connect(board, SIGNAL(doubleCube(const int)), engine[currEngine], SLOT(doubleCube(const int)));
- connect(board, SIGNAL(currentMove(QString *)), engine[currEngine], SLOT(handleMove(QString *)));
+ connect(board, TQT_SIGNAL(rollDice(const int)), engine[currEngine], TQT_SLOT(rollDice(const int)));
+ connect(board, TQT_SIGNAL(doubleCube(const int)), engine[currEngine], TQT_SLOT(doubleCube(const int)));
+ connect(board, TQT_SIGNAL(currentMove(TQString *)), engine[currEngine], TQT_SLOT(handleMove(TQString *)));
// engine -> board
- connect(engine[currEngine], SIGNAL(undoMove()), board, SLOT(undoMove()));
- connect(engine[currEngine], SIGNAL(redoMove()), board, SLOT(redoMove()));
- connect(engine[currEngine], SIGNAL(setEditMode(const bool)), board, SLOT(setEditMode(const bool)));
- connect(engine[currEngine], SIGNAL(allowMoving(const bool)), board, SLOT(allowMoving(const bool)));
- connect(engine[currEngine], SIGNAL(getState(KBgStatus *)), board, SLOT(getState(KBgStatus *)));
- connect(engine[currEngine], SIGNAL(newState(const KBgStatus &)), board, SLOT(setState(const KBgStatus &)));
+ connect(engine[currEngine], TQT_SIGNAL(undoMove()), board, TQT_SLOT(undoMove()));
+ connect(engine[currEngine], TQT_SIGNAL(redoMove()), board, TQT_SLOT(redoMove()));
+ connect(engine[currEngine], TQT_SIGNAL(setEditMode(const bool)), board, TQT_SLOT(setEditMode(const bool)));
+ connect(engine[currEngine], TQT_SIGNAL(allowMoving(const bool)), board, TQT_SLOT(allowMoving(const bool)));
+ connect(engine[currEngine], TQT_SIGNAL(getState(KBgStatus *)), board, TQT_SLOT(getState(KBgStatus *)));
+ connect(engine[currEngine], TQT_SIGNAL(newState(const KBgStatus &)), board, TQT_SLOT(setState(const KBgStatus &)));
// now that all signals are connected, start the engine
engine[currEngine]->start();
@@ -363,14 +363,14 @@ void KBg::readConfig()
config->setGroup("main window");
- QPoint pos, defpos(10, 10);
- QFont kappFont = kapp->font();
+ TQPoint pos, defpos(10, 10);
+ TQFont kappFont = kapp->font();
pos = config->readPointEntry("origin", &defpos);
status->setFont(config->readFontEntry("font", &kappFont));
- QValueList<int> l;
+ TQValueList<int> l;
l.append(qRound( config->readDoubleNumEntry("panner", 0.75) *panner->height()));
l.append(qRound((1-config->readDoubleNumEntry("panner", 0.75))*panner->height()));
panner->setSizes(l);
@@ -481,7 +481,7 @@ void KBg::setupDone()
// FIXME make more general...
-void KBg::startKCM(const QString &url)
+void KBg::startKCM(const TQString &url)
{
KRun::runCommand(url);
}
@@ -506,29 +506,29 @@ void KBg::setupDlg()
/*
* Main Widget
*/
- QVBox *w = nb->addVBoxPage(i18n("General"), i18n("Here you can configure general settings of %1").
+ TQVBox *w = nb->addVBoxPage(i18n("General"), i18n("Here you can configure general settings of %1").
arg(kapp->aboutData()->programName()),
kapp->iconLoader()->loadIcon("go", KIcon::Desktop));
/*
* Group boxes
*/
- QGroupBox *gbm = new QGroupBox(i18n("Messages"), w);
- QGroupBox *gbt = new QGroupBox(i18n("Timer"), w);
- QGroupBox *gbs = new QGroupBox(i18n("Autosave"), w);
- QGroupBox *gbe = new QGroupBox(i18n("Events"), w);
+ TQGroupBox *gbm = new TQGroupBox(i18n("Messages"), w);
+ TQGroupBox *gbt = new TQGroupBox(i18n("Timer"), w);
+ TQGroupBox *gbs = new TQGroupBox(i18n("Autosave"), w);
+ TQGroupBox *gbe = new TQGroupBox(i18n("Events"), w);
/*
* Timer box
*/
- QWhatsThis::add(gbt, i18n("After you finished your moves, they have to be sent to the engine. "
+ TQWhatsThis::add(gbt, i18n("After you finished your moves, they have to be sent to the engine. "
"You can either do that manually (in which case you should not enable "
"this feature), or you can specify an amount of time that has to pass "
"before the move is committed. If you undo a move during the timeout, the "
"timeout will be reset and restarted once you finish the move. This is "
"very useful if you would like to review the result of your move."));
- cbt = new QCheckBox(i18n("Enable timeout"), gbt);
+ cbt = new TQCheckBox(i18n("Enable timeout"), gbt);
cbt->setChecked(config->readBoolEntry("enable timeout", true));
sbt = new KDoubleNumInput(gbt);
@@ -536,49 +536,49 @@ void KBg::setupDlg()
sbt->setLabel(i18n("Move timeout in seconds:"));
sbt->setValue(config->readDoubleNumEntry("timeout", 2.5));
- connect(cbt, SIGNAL(toggled(bool)), sbt, SLOT(setEnabled(bool)));
+ connect(cbt, TQT_SIGNAL(toggled(bool)), sbt, TQT_SLOT(setEnabled(bool)));
sbt->setEnabled(cbt->isChecked());
- QGridLayout *gl = new QGridLayout(gbt, 2, 1, 20);
+ TQGridLayout *gl = new TQGridLayout(gbt, 2, 1, 20);
gl->addWidget(cbt, 0, 0);
gl->addWidget(sbt, 1, 0);
/*
* Enable messages
*/
- QWhatsThis::add(gbm, i18n("Check the box to enable all the messages that you have previously "
+ TQWhatsThis::add(gbm, i18n("Check the box to enable all the messages that you have previously "
"disabled by choosing the \"Don't show this message again\" option."));
- QGridLayout *glm = new QGridLayout(gbm, 1, 1, nb->spacingHint());
- cbm = new QCheckBox(i18n("Reenable all messages"), gbm);
+ TQGridLayout *glm = new TQGridLayout(gbm, 1, 1, nb->spacingHint());
+ cbm = new TQCheckBox(i18n("Reenable all messages"), gbm);
glm->addWidget(cbm, 0, 0);
/*
* Save options on exit ?
*/
- QWhatsThis::add(gbm, i18n("Check the box to automatically save all window positions on program "
+ TQWhatsThis::add(gbm, i18n("Check the box to automatically save all window positions on program "
"exit. They will be restored at next start."));
- QGridLayout *gls = new QGridLayout(gbs, 1, 1, nb->spacingHint());
- cbs = new QCheckBox(i18n("Save settings on exit"), gbs);
+ TQGridLayout *gls = new TQGridLayout(gbs, 1, 1, nb->spacingHint());
+ cbs = new TQCheckBox(i18n("Save settings on exit"), gbs);
cbs->setChecked(config->readBoolEntry("autosave on exit", true));
gls->addWidget(cbs, 0, 0);
/*
* Event vonfiguration
*/
- QWhatsThis::add(gbe, i18n("Event notification of %1 is configured as part of the "
+ TQWhatsThis::add(gbe, i18n("Event notification of %1 is configured as part of the "
"system-wide notification process. Click here, and you "
"will be able to configure system sounds, etc.").
arg(kapp->aboutData()->programName()));
- QGridLayout *gle = new QGridLayout(gbe, 1, 1, nb->spacingHint());
+ TQGridLayout *gle = new TQGridLayout(gbe, 1, 1, nb->spacingHint());
KURLLabel *lab = new KURLLabel("kcmshell kcmnotify",
i18n("Klick here to configure the event notification"), gbe);
lab->setMaximumSize(lab->sizeHint());
gle->addWidget(lab, 0, 0);
- connect(lab, SIGNAL(leftClickedURL(const QString &)), SLOT(startKCM(const QString &)));
+ connect(lab, TQT_SIGNAL(leftClickedURL(const TQString &)), TQT_SLOT(startKCM(const TQString &)));
/*
* Board settings
@@ -589,8 +589,8 @@ void KBg::setupDlg()
* Hack alert: this little trick makes sure that ALL engines
* have their settings available in the dialog.
*/
- QPopupMenu *dummyPopup = new QPopupMenu(nb);
- QString s = PROG_NAME;
+ TQPopupMenu *dummyPopup = new TQPopupMenu(nb);
+ TQString s = PROG_NAME;
for (int i = 0; i < MaxEngine; i++) {
if (currEngine != i) {
switch (i) {
@@ -607,7 +607,7 @@ void KBg::setupDlg()
engine[i] = new KBgEngineNg(nb, &s, dummyPopup);
break;
}
- connect(this, SIGNAL(saveSettings()), engine[i], SLOT(saveConfig()));
+ connect(this, TQT_SIGNAL(saveSettings()), engine[i], TQT_SLOT(saveConfig()));
}
engine[i]->getSetupPages(nb);
}
@@ -615,12 +615,12 @@ void KBg::setupDlg()
/*
* Connect the signals of nb
*/
- connect(nb, SIGNAL(okClicked()), this, SLOT(setupOk()));
- connect(nb, SIGNAL(applyClicked()), this, SLOT(setupOk()));
- connect(nb, SIGNAL(cancelClicked()), this, SLOT(setupCancel()));
- connect(nb, SIGNAL(defaultClicked()),this, SLOT(setupDefault()));
+ connect(nb, TQT_SIGNAL(okClicked()), this, TQT_SLOT(setupOk()));
+ connect(nb, TQT_SIGNAL(applyClicked()), this, TQT_SLOT(setupOk()));
+ connect(nb, TQT_SIGNAL(cancelClicked()), this, TQT_SLOT(setupCancel()));
+ connect(nb, TQT_SIGNAL(defaultClicked()),this, TQT_SLOT(setupDefault()));
- connect(nb, SIGNAL(finished()), this, SLOT(setupDone()));
+ connect(nb, TQT_SIGNAL(finished()), this, TQT_SLOT(setupDone()));
nb->resize(nb->minimumSize());
nb->show();
@@ -647,7 +647,7 @@ void KBg::print()
prt->setOrientation((KPrinter::Orientation)config->readNumEntry("orientation", KPrinter::Landscape));
if (prt->setup(this, i18n("Print %1").arg(baseCaption))) {
- QPainter p;
+ TQPainter p;
p.begin(prt);
board->print(&p);
p.end();
@@ -686,7 +686,7 @@ void KBg::configureToolbars()
{
saveMainWindowSettings(KGlobal::config(), "kedittoolbar settings"); // temp group
KEditToolbar dlg(actionCollection(), xmlFile(), true, this);
- connect(&dlg,SIGNAL(newToolbarConfig()),this,SLOT(newToolbarConfig()));
+ connect(&dlg,TQT_SIGNAL(newToolbarConfig()),this,TQT_SLOT(newToolbarConfig()));
dlg.exec();
KGlobal::config()->deleteGroup( "kedittoolbar settings" ); // delete temp group
}
@@ -748,14 +748,14 @@ bool KBg::queryClose()
* Set the caption of the main window. If the user has requested pip
* counts, they are appended, too.
*/
-void KBg::updateCaption(const QString &s)
+void KBg::updateCaption(const TQString &s)
{
baseCaption = s;
- QString msg;
+ TQString msg;
if (!s.isEmpty()) {
msg = s;
if (board->getPipCount(US) >= 0) {
- QString tmp;
+ TQString tmp;
tmp.setNum(board->getPipCount(US ));
msg += " - " + tmp;
tmp.setNum(board->getPipCount(THEM));
@@ -769,7 +769,7 @@ void KBg::updateCaption(const QString &s)
* Take the string from the commandline, give it to the engine, append
* to the history and clear the buffer.
*/
-void KBg::handleCmd(const QString &s)
+void KBg::handleCmd(const TQString &s)
{
if (!s.stripWhiteSpace().isEmpty()) {
engine[currEngine]->handleCommand(s);
@@ -810,7 +810,7 @@ void KBg::allowCommand(int cmd, bool f)
* Catch the hide envents. That way, the current engine can close its
* child windows.
*/
-void KBg::hideEvent(QHideEvent *e)
+void KBg::hideEvent(TQHideEvent *e)
{
KMainWindow::hideEvent(e);
engine[currEngine]->hideEvent();
@@ -820,7 +820,7 @@ void KBg::hideEvent(QHideEvent *e)
* Catch the show envents. That way, the current engine can open any
* previously hidden windows.
*/
-void KBg::showEvent(QShowEvent *e)
+void KBg::showEvent(TQShowEvent *e)
{
KMainWindow::showEvent(e);
engine[currEngine]->showEvent();