diff options
Diffstat (limited to 'kpat/pwidget.cpp')
-rw-r--r-- | kpat/pwidget.cpp | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/kpat/pwidget.cpp b/kpat/pwidget.cpp index dae69f60..eb12a1c8 100644 --- a/kpat/pwidget.cpp +++ b/kpat/pwidget.cpp @@ -20,9 +20,9 @@ #include <stdio.h> -#include <qregexp.h> -#include <qtimer.h> -#include <qimage.h> +#include <tqregexp.h> +#include <tqtimer.h> +#include <tqimage.h> #include <kapplication.h> #include <klocale.h> @@ -59,32 +59,32 @@ pWidget::pWidget() { current_pwidget = this; // KCrash::setEmergencySaveFunction(::saveGame); - KStdAction::quit(kapp, SLOT(quit()), actionCollection(), "game_exit"); + KStdAction::quit(kapp, TQT_SLOT(quit()), actionCollection(), "game_exit"); - undo = KStdAction::undo(this, SLOT(undoMove()), + undo = KStdAction::undo(this, TQT_SLOT(undoMove()), actionCollection(), "undo_move"); undo->setEnabled(false); - (void)KStdAction::openNew(this, SLOT(newGame()), + (void)KStdAction::openNew(this, TQT_SLOT(newGame()), actionCollection(), "new_game"); - (void)KStdAction::open(this, SLOT(openGame()), + (void)KStdAction::open(this, TQT_SLOT(openGame()), actionCollection(), "open"); - recent = KStdAction::openRecent(this, SLOT(openGame(const KURL&)), + recent = KStdAction::openRecent(this, TQT_SLOT(openGame(const KURL&)), actionCollection(), "open_recent"); recent->loadEntries(KGlobal::config()); - (void)KStdAction::saveAs(this, SLOT(saveGame()), + (void)KStdAction::saveAs(this, TQT_SLOT(saveGame()), actionCollection(), "save"); - (void)new KAction(i18n("&Choose Game..."), 0, this, SLOT(chooseGame()), + (void)new KAction(i18n("&Choose Game..."), 0, this, TQT_SLOT(chooseGame()), actionCollection(), "choose_game"); - (void)new KAction(i18n("Restart &Game"), QString::fromLatin1("reload"), 0, - this, SLOT(restart()), + (void)new KAction(i18n("Restart &Game"), TQString::fromLatin1("reload"), 0, + this, TQT_SLOT(restart()), actionCollection(), "restart_game"); - (void)KStdAction::help(this, SLOT(helpGame()), actionCollection(), "help_game"); + (void)KStdAction::help(this, TQT_SLOT(helpGame()), actionCollection(), "help_game"); games = new KSelectAction(i18n("&Game Type"), 0, this, - SLOT(newGameType()), + TQT_SLOT(newGameType()), actionCollection(), "game_type"); - QStringList list; - QValueList<DealerInfo*>::ConstIterator it; + TQStringList list; + TQValueList<DealerInfo*>::ConstIterator it; uint max_type = 0; for (it = DealerInfoList::self()->games().begin(); @@ -105,18 +105,18 @@ pWidget::pWidget() KGlobal::dirs()->addResourceType("wallpaper", KStandardDirs::kde_default("data") + "kpat/backgrounds/"); KGlobal::dirs()->addResourceType("wallpaper", KStandardDirs::kde_default("data") + "ksnake/backgrounds/"); wallpapers = new KSelectAction(i18n("&Change Background"), 0, this, - SLOT(changeWallpaper()), + TQT_SLOT(changeWallpaper()), actionCollection(), "wallpaper"); list.clear(); wallpaperlist.clear(); - QStringList wallpaperlist2 = KGlobal::dirs()->findAllResources("wallpaper", QString::null, + TQStringList wallpaperlist2 = KGlobal::dirs()->findAllResources("wallpaper", TQString::null, false, true, list); - QStringList list2; - for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { - QString file = *it; + TQStringList list2; + for (TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { + TQString file = *it; int rindex = file.findRev('.'); if (rindex != -1) { - QString ext = file.mid(rindex + 1).lower(); + TQString ext = file.mid(rindex + 1).lower(); if (ext == "jpeg" || ext == "png" || ext == "jpg") { list2.append(file.left(rindex)); wallpaperlist.append( file ); @@ -132,27 +132,27 @@ pWidget::pWidget() (void)new cardMap(midcolor); backs = new KAction(i18n("&Switch Cards..."), 0, this, - SLOT(changeBackside()), + TQT_SLOT(changeBackside()), actionCollection(), "backside"); - stats = new KAction(i18n("&Statistics"), 0, this, SLOT(showStats()), + stats = new KAction(i18n("&Statistics"), 0, this, TQT_SLOT(showStats()), actionCollection(),"game_stats"); animation = new KToggleAction(i18n( "&Animation on Startup" ), - 0, this, SLOT(animationChanged()), + 0, this, TQT_SLOT(animationChanged()), actionCollection(), "animation"); dropaction = new KToggleAction(i18n("&Enable Autodrop"), - 0, this, SLOT(enableAutoDrop()), + 0, this, TQT_SLOT(enableAutoDrop()), actionCollection(), "enable_autodrop"); dropaction->setCheckedState(i18n("Disable Autodrop")); KConfig *config = kapp->config(); KConfigGroupSaver cs(config, settings_group ); - QString bgpath = config->readPathEntry("Background"); + TQString bgpath = config->readPathEntry("Background"); kdDebug(11111) << "bgpath '" << bgpath << "'" << endl; if (bgpath.isEmpty()) bgpath = locate("wallpaper", "No-Ones-Laughing-3.jpg"); - background = QPixmap(bgpath); + background = TQPixmap(bgpath); bool animate = config->readBoolEntry( "Animation", true); animation->setChecked( animate ); @@ -167,7 +167,7 @@ pWidget::pWidget() statusBar()->insertItem( "", 1, 0, true ); - createGUI(QString::null, false); + createGUI(TQString::null, false); KAcceleratorManager::manage(menuBar()); newGameType(); @@ -201,13 +201,13 @@ void pWidget::changeBackside() { KConfig *config = kapp->config(); KConfigGroupSaver kcs(config, settings_group); - QString deck = config->readEntry("Back", KCardDialog::getDefaultDeck()); - QString cards = config->readEntry("Cards", KCardDialog::getDefaultCardDir()); - if (KCardDialog::getCardDeck(deck, cards, this, KCardDialog::Both) == QDialog::Accepted) + TQString deck = config->readEntry("Back", KCardDialog::getDefaultDeck()); + TQString cards = config->readEntry("Cards", KCardDialog::getDefaultCardDir()); + if (KCardDialog::getCardDeck(deck, cards, this, KCardDialog::Both) == TQDialog::Accepted) { - QString imgname = KCardDialog::getCardPath(cards, 11); + TQString imgname = KCardDialog::getCardPath(cards, 11); - QImage image; + TQImage image; image.load(imgname); if( image.isNull()) { kdDebug(11111) << "cannot load card pixmap \"" << imgname << "\" in " << cards << "\n"; @@ -234,16 +234,16 @@ void pWidget::changeBackside() { void pWidget::changeWallpaper() { - QString bgpath=locate("wallpaper", wallpaperlist[wallpapers->currentItem()]); + TQString bgpath=locate("wallpaper", wallpaperlist[wallpapers->currentItem()]); if (bgpath.isEmpty()) return; - background = QPixmap(bgpath); + background = TQPixmap(bgpath); if (background.isNull()) { KMessageBox::sorry(this, i18n("<qt>Couldn't load wallpaper<br/>%1</qt>").arg(bgpath)); return; } - QImage bg = background.convertToImage().convertDepth(8, 0); + TQImage bg = background.convertToImage().convertDepth(8, 0); if (bg.isNull() || !bg.numColors()) return; long r = 0; @@ -259,14 +259,14 @@ void pWidget::changeWallpaper() r /= bg.numColors(); b /= bg.numColors(); g /= bg.numColors(); - midcolor = QColor(r, b, g); + midcolor = TQColor(r, b, g); if (dill) { KConfig *config = kapp->config(); KConfigGroupSaver kcs(config, settings_group); - QString deck = config->readEntry("Back", KCardDialog::getDefaultDeck()); - QString dummy = config->readEntry("Cards", KCardDialog::getDefaultCardDir()); + TQString deck = config->readEntry("Back", KCardDialog::getDefaultDeck()); + TQString dummy = config->readEntry("Cards", KCardDialog::getDefaultCardDir()); setBackSide(deck, dummy); config->writePathEntry("Background", bgpath); @@ -322,12 +322,12 @@ void pWidget::restart() void pWidget::setGameCaption() { - QString name = games->currentText(); - QString newname; - QString gamenum; + TQString name = games->currentText(); + TQString newname; + TQString gamenum; gamenum.setNum( dill->gameNumber() ); for (uint i = 0; i < name.length(); i++) - if (name.at(i) != QChar('&')) + if (name.at(i) != TQChar('&')) newname += name.at(i); setCaption( newname + " - " + gamenum ); @@ -340,18 +340,18 @@ void pWidget::newGameType() slotUpdateMoves(); uint id = games->currentItem(); - for (QValueList<DealerInfo*>::ConstIterator it = DealerInfoList::self()->games().begin(); it != DealerInfoList::self()->games().end(); ++it) { + for (TQValueList<DealerInfo*>::ConstIterator it = DealerInfoList::self()->games().begin(); it != DealerInfoList::self()->games().end(); ++it) { if ((*it)->gameindex == id) { dill = (*it)->createGame(this); - QString name = (*it)->name; - name = name.replace(QRegExp("[&']"), ""); - name = name.replace(QRegExp("[ ]"), "_").lower(); + TQString name = (*it)->name; + name = name.replace(TQRegExp("[&']"), ""); + name = name.replace(TQRegExp("[ ]"), "_").lower(); dill->setAnchorName("game_" + name); - connect(dill, SIGNAL(saveGame()), SLOT(saveGame())); - connect(dill, SIGNAL(gameInfo(const QString&)), - SLOT(slotGameInfo(const QString &))); - connect(dill, SIGNAL(updateMoves()), - SLOT(slotUpdateMoves())); + connect(dill, TQT_SIGNAL(saveGame()), TQT_SLOT(saveGame())); + connect(dill, TQT_SIGNAL(gameInfo(const TQString&)), + TQT_SLOT(slotGameInfo(const TQString &))); + connect(dill, TQT_SIGNAL(updateMoves()), + TQT_SLOT(slotUpdateMoves())); dill->setGameId(id); dill->setupActions(); dill->setBackgroundPixmap(background, midcolor); @@ -365,9 +365,9 @@ void pWidget::newGameType() dill = DealerInfoList::self()->games().first()->createGame(this); } - connect(dill, SIGNAL(undoPossible(bool)), SLOT(undoPossible(bool))); - connect(dill, SIGNAL(gameWon(bool)), SLOT(gameWon(bool))); - connect(dill, SIGNAL(gameLost()), SLOT(gameLost())); + connect(dill, TQT_SIGNAL(undoPossible(bool)), TQT_SLOT(undoPossible(bool))); + connect(dill, TQT_SIGNAL(gameWon(bool)), TQT_SLOT(gameWon(bool))); + connect(dill, TQT_SIGNAL(gameLost()), TQT_SLOT(gameLost())); dill->setAutoDropEnabled(dropaction->isChecked()); @@ -381,7 +381,7 @@ void pWidget::newGameType() KConfigGroupSaver kcs(config, settings_group); config->writeEntry("DefaultGame", id); - QSize min(700,400); + TQSize min(700,400); min = min.expandedTo(dill->minimumCardSize()); dill->setMinimumSize(min); dill->resize(min); @@ -390,14 +390,14 @@ void pWidget::newGameType() dill->show(); } -void pWidget::showEvent(QShowEvent *e) +void pWidget::showEvent(TQShowEvent *e) { if (dill) - dill->setMinimumSize(QSize(0,0)); + dill->setMinimumSize(TQSize(0,0)); KMainWindow::showEvent(e); } -void pWidget::slotGameInfo(const QString &text) +void pWidget::slotGameInfo(const TQString &text) { statusBar()->message(text, 3000); } @@ -409,11 +409,11 @@ void pWidget::slotUpdateMoves() statusBar()->changeItem( i18n("1 move", "%n moves", moves), 1 ); } -void pWidget::setBackSide(const QString &deck, const QString &cards) +void pWidget::setBackSide(const TQString &deck, const TQString &cards) { KConfig *config = kapp->config(); KConfigGroupSaver kcs(config, settings_group); - QPixmap pm(deck); + TQPixmap pm(deck); if(!pm.isNull()) { cardMap::self()->setBackSide(pm, false); config->writeEntry("Back", deck); @@ -437,7 +437,7 @@ void pWidget::setBackSide(const QString &deck, const QString &cards) void pWidget::chooseGame() { bool ok; - long number = KInputDialog::getText(i18n("Game Number"), i18n("Enter a game number (FreeCell deals are the same as in the FreeCell FAQ):"), QString::number(dill->gameNumber()), 0, this).toLong(&ok); + long number = KInputDialog::getText(i18n("Game Number"), i18n("Enter a game number (FreeCell deals are the same as in the FreeCell FAQ):"), TQString::number(dill->gameNumber()), 0, this).toLong(&ok); if (ok) { dill->setGameNumber(number); setGameCaption(); @@ -447,7 +447,7 @@ void pWidget::chooseGame() void pWidget::gameWon(bool withhelp) { - QString congrats; + TQString congrats; if (withhelp) congrats = i18n("Congratulations! We have won!"); else @@ -455,7 +455,7 @@ void pWidget::gameWon(bool withhelp) #if TEST_SOLVER == 0 KMessageBox::information(this, congrats, i18n("Congratulations!")); #endif - QTimer::singleShot(0, this, SLOT(newGame())); + TQTimer::singleShot(0, this, TQT_SLOT(newGame())); #if TEST_SOLVER == 1 dill->demo(); #endif @@ -463,17 +463,17 @@ void pWidget::gameWon(bool withhelp) void pWidget::gameLost() { - QString dontAskAgainName = "gameLostDontAskAgain"; + TQString dontAskAgainName = "gameLostDontAskAgain"; // The following code is taken out of kmessagebox.cpp in kdeui. // Is there a better way? KConfig *config = 0; - QString grpNotifMsgs = QString::fromLatin1("Notification Messages"); + TQString grpNotifMsgs = TQString::fromLatin1("Notification Messages"); config = KGlobal::config(); KConfigGroupSaver saver(config, - QString::fromLatin1("Notification Messages")); - QString dontAsk = config->readEntry(dontAskAgainName).lower(); + TQString::fromLatin1("Notification Messages")); + TQString dontAsk = config->readEntry(dontAskAgainName).lower(); // If we are ordered never to ask again and to continue the game, // then do so. @@ -482,7 +482,7 @@ void pWidget::gameLost() // If it says yes, we ask anyway. Just starting a new game would // be incredibly annoying. if (dontAsk == "yes") - dontAskAgainName = QString::null; + dontAskAgainName = TQString::null; if (KMessageBox::questionYesNo(this, i18n("You could not win this game, " "but there is always a second try.\nStart a new game?"), @@ -491,19 +491,19 @@ void pWidget::gameLost() KStdGuiItem::cont(), dontAskAgainName) == KMessageBox::Yes) { - QTimer::singleShot(0, this, SLOT(newGame())); + TQTimer::singleShot(0, this, TQT_SLOT(newGame())); } } void pWidget::openGame(const KURL &url) { - QString tmpFile; + TQString tmpFile; if( KIO::NetAccess::download( url, tmpFile, this ) ) { - QFile of(tmpFile); + TQFile of(tmpFile); of.open(IO_ReadOnly); - QDomDocument doc; - QString error; + TQDomDocument doc; + TQString error; if (!doc.setContent(&of, &error)) { KMessageBox::sorry(this, error); @@ -538,9 +538,9 @@ void pWidget::saveGame() { KURL url = KFileDialog::getSaveURL(); KTempFile file; - QDomDocument doc("kpat"); + TQDomDocument doc("kpat"); dill->saveGame(doc); - QTextStream *stream = file.textStream(); + TQTextStream *stream = file.textStream(); *stream << doc.toString(); file.close(); KIO::NetAccess::upload(file.name(), url, this); |