diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:42:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:42:31 +0000 |
commit | 576eb4299a00bc053db35414406f46372a0f70f2 (patch) | |
tree | 4c030922d533821db464af566188e7d40cc8848c /kolf/newgame.cpp | |
parent | 0718336b6017d1a4fc1d626544180a5a2a29ddec (diff) | |
download | tdegames-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 'kolf/newgame.cpp')
-rw-r--r-- | kolf/newgame.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/kolf/newgame.cpp b/kolf/newgame.cpp index d038185e..22c6b785 100644 --- a/kolf/newgame.cpp +++ b/kolf/newgame.cpp @@ -12,30 +12,30 @@ #include <kfiledialog.h> #include <kurllabel.h> -#include <qcheckbox.h> -#include <qevent.h> -#include <qframe.h> -#include <qpen.h> -#include <qlayout.h> -#include <qlabel.h> +#include <tqcheckbox.h> +#include <tqevent.h> +#include <tqframe.h> +#include <tqpen.h> +#include <tqlayout.h> +#include <tqlabel.h> #include <klistbox.h> -#include <qstyle.h> -#include <qrect.h> -#include <qmap.h> -#include <qpainter.h> -#include <qpixmapcache.h> -#include <qwidget.h> -#include <qscrollview.h> -#include <qvaluelist.h> -#include <qptrlist.h> -#include <qstringlist.h> -#include <qstring.h> -#include <qvbox.h> +#include <tqstyle.h> +#include <tqrect.h> +#include <tqmap.h> +#include <tqpainter.h> +#include <tqpixmapcache.h> +#include <tqwidget.h> +#include <tqscrollview.h> +#include <tqvaluelist.h> +#include <tqptrlist.h> +#include <tqstringlist.h> +#include <tqstring.h> +#include <tqvbox.h> #include "newgame.h" #include "game.h" -NewGameDialog::NewGameDialog(bool enableCourses, QWidget *parent, const char *_name) +NewGameDialog::NewGameDialog(bool enableCourses, TQWidget *parent, const char *_name) : KDialogBase(KDialogBase::TreeList, i18n("New Game"), Ok | Cancel, Ok, parent, _name) { this->enableCourses = enableCourses; @@ -47,34 +47,34 @@ NewGameDialog::NewGameDialog(bool enableCourses, QWidget *parent, const char *_n startColors << yellow << blue << red << lightGray << cyan << darkBlue << magenta << darkGray << darkMagenta << darkYellow; playerPage = addPage(i18n("Players")); - QVBoxLayout *bigLayout = new QVBoxLayout(playerPage, marginHint(), spacingHint()); + TQVBoxLayout *bigLayout = new TQVBoxLayout(playerPage, marginHint(), spacingHint()); addButton = new KPushButton(i18n("&New Player"), playerPage); bigLayout->addWidget(addButton); - connect(addButton, SIGNAL(clicked()), this, SLOT(addPlayer())); + connect(addButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(addPlayer())); - scroller = new QScrollView(playerPage); + scroller = new TQScrollView(playerPage); bigLayout->addWidget(scroller); - layout = new QVBox(scroller->viewport()); - if (!QPixmapCache::find("grass", grass)) + layout = new TQVBox(scroller->viewport()); + if (!TQPixmapCache::find("grass", grass)) { grass.load(locate("appdata", "pics/grass.png")); - QPixmapCache::insert("grass", grass); + TQPixmapCache::insert("grass", grass); } scroller->viewport()->setBackgroundPixmap(grass); scroller->addChild(layout); - QMap<QString, QString> entries = config->entryMap("New Game Dialog"); + TQMap<TQString, TQString> entries = config->entryMap("New Game Dialog"); unsigned int i = 0; - for (QMap<QString, QString>::Iterator it = entries.begin(); it != entries.end(); ++it) + for (TQMap<TQString, TQString>::Iterator it = entries.begin(); it != entries.end(); ++it) { if (i > startColors.count()) return; addPlayer(); editors.last()->setName(it.key().right(it.key().length() - 1)); - editors.last()->setColor(QColor(it.data())); + editors.last()->setColor(TQColor(it.data())); ++i; } @@ -89,13 +89,13 @@ NewGameDialog::NewGameDialog(bool enableCourses, QWidget *parent, const char *_n if (enableCourses) { coursePage = addPage(i18n("Course"), i18n("Choose Course to Play")); - QVBoxLayout *coursePageLayout = new QVBoxLayout(coursePage, marginHint(), spacingHint()); + TQVBoxLayout *coursePageLayout = new TQVBoxLayout(coursePage, marginHint(), spacingHint()); KURLLabel *coursesLink = new KURLLabel("http://web.mit.edu/~jasonkb/www/kolf/", "http://web.mit.edu/~jasonkb/www/kolf/", coursePage); - connect(coursesLink, SIGNAL(leftClickedURL(const QString &)), kapp, SLOT(invokeBrowser(const QString &))); + connect(coursesLink, TQT_SIGNAL(leftClickedURL(const TQString &)), kapp, TQT_SLOT(invokeBrowser(const TQString &))); coursePageLayout->addWidget(coursesLink); - QHBoxLayout *hlayout = new QHBoxLayout(coursePageLayout, spacingHint()); + TQHBoxLayout *hlayout = new TQHBoxLayout(coursePageLayout, spacingHint()); // following use this group config->setGroup("New Game Dialog Mode"); @@ -104,14 +104,14 @@ NewGameDialog::NewGameDialog(bool enableCourses, QWidget *parent, const char *_n externCourses = config->readListEntry("extra"); /// course loading - QStringList items = externCourses + KGlobal::dirs()->findAllResources("appdata", "courses/*"); - QStringList nameList; - const QString lastCourse(config->readEntry("course", "")); + TQStringList items = externCourses + KGlobal::dirs()->findAllResources("appdata", "courses/*"); + TQStringList nameList; + const TQString lastCourse(config->readEntry("course", "")); int curItem = 0; i = 0; - for (QStringList::Iterator it = items.begin(); it != items.end(); ++it, ++i) + for (TQStringList::Iterator it = items.begin(); it != items.end(); ++it, ++i) { - QString file = *it; + TQString file = *it; CourseInfo curinfo; KolfGame::courseInfo(curinfo, file); info[file] = curinfo; @@ -122,47 +122,47 @@ NewGameDialog::NewGameDialog(bool enableCourses, QWidget *parent, const char *_n curItem = i; } - const QString newName(i18n("Create New")); - info[QString::null] = CourseInfo(newName, newName, i18n("You"), 0, 0); - names.append(QString::null); + const TQString newName(i18n("Create New")); + info[TQString::null] = CourseInfo(newName, newName, i18n("You"), 0, 0); + names.append(TQString::null); nameList.append(newName); courseList = new KListBox(coursePage); hlayout->addWidget(courseList); courseList->insertStringList(nameList); courseList->setCurrentItem(curItem); - connect(courseList, SIGNAL(highlighted(int)), this, SLOT(courseSelected(int))); - connect(courseList, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); + connect(courseList, TQT_SIGNAL(highlighted(int)), this, TQT_SLOT(courseSelected(int))); + connect(courseList, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(selectionChanged())); - QVBoxLayout *detailLayout = new QVBoxLayout(hlayout, spacingHint()); - name = new QLabel(coursePage); + TQVBoxLayout *detailLayout = new TQVBoxLayout(hlayout, spacingHint()); + name = new TQLabel(coursePage); detailLayout->addWidget(name); - author = new QLabel(coursePage); + author = new TQLabel(coursePage); detailLayout->addWidget(author); - QHBoxLayout *minorLayout = new QHBoxLayout(detailLayout, spacingHint()); - par = new QLabel(coursePage); + TQHBoxLayout *minorLayout = new TQHBoxLayout(detailLayout, spacingHint()); + par = new TQLabel(coursePage); minorLayout->addWidget(par); - holes = new QLabel(coursePage); + holes = new TQLabel(coursePage); minorLayout->addWidget(holes); detailLayout->addStretch(); KPushButton *scores = new KPushButton(i18n("Highscores"), coursePage); - connect(scores, SIGNAL(clicked()), this, SLOT(showHighscores())); + connect(scores, TQT_SIGNAL(clicked()), this, TQT_SLOT(showHighscores())); detailLayout->addWidget(scores); detailLayout->addStretch(); detailLayout->addWidget(new KSeparator(coursePage)); - minorLayout = new QHBoxLayout(detailLayout, spacingHint()); + minorLayout = new TQHBoxLayout(detailLayout, spacingHint()); KPushButton *addCourseButton = new KPushButton(i18n("Add..."), coursePage); minorLayout->addWidget(addCourseButton); - connect(addCourseButton, SIGNAL(clicked()), this, SLOT(addCourse())); + connect(addCourseButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(addCourse())); remove = new KPushButton(i18n("Remove"), coursePage); minorLayout->addWidget(remove); - connect(remove, SIGNAL(clicked()), this, SLOT(removeCourse())); + connect(remove, TQT_SIGNAL(clicked()), this, TQT_SLOT(removeCourse())); courseSelected(curItem); selectionChanged(); @@ -170,13 +170,13 @@ NewGameDialog::NewGameDialog(bool enableCourses, QWidget *parent, const char *_n // options page optionsPage = addPage(i18n("Options"), i18n("Game Options")); - QVBoxLayout *vlayout = new QVBoxLayout(optionsPage, marginHint(), spacingHint()); + TQVBoxLayout *vlayout = new TQVBoxLayout(optionsPage, marginHint(), spacingHint()); - mode = new QCheckBox(i18n("&Strict mode"), optionsPage); + mode = new TQCheckBox(i18n("&Strict mode"), optionsPage); vlayout->addWidget(mode); mode->setChecked(config->readBoolEntry("competition", false)); - QLabel *desc = new QLabel(i18n("In strict mode, undo, editing, and switching holes is not allowed. This is generally for competition. Only in strict mode are highscores kept."), optionsPage); + TQLabel *desc = new TQLabel(i18n("In strict mode, undo, editing, and switching holes is not allowed. This is generally for competition. Only in strict mode are highscores kept."), optionsPage); desc->setTextFormat(RichText); vlayout->addWidget(desc); } @@ -199,7 +199,7 @@ void NewGameDialog::slotOk() PlayerEditor *curEditor = 0; int i = 0; for (curEditor = editors.first(); curEditor; curEditor = editors.next(), ++i) - config->writeEntry(QString::number(i) + curEditor->name(), curEditor->color().name()); + config->writeEntry(TQString::number(i) + curEditor->name(), curEditor->color().name()); config->sync(); @@ -212,7 +212,7 @@ void NewGameDialog::courseSelected(int index) CourseInfo &curinfo = info[currentCourse]; - name->setText(QString("<strong>%1</strong>").arg(curinfo.name)); + name->setText(TQString("<strong>%1</strong>").arg(curinfo.name)); author->setText(i18n("By %1").arg(curinfo.author)); par->setText(i18n("Par %1").arg(curinfo.par)); @@ -223,7 +223,7 @@ void NewGameDialog::showHighscores() { KScoreDialog *scoreDialog = new KScoreDialog(KScoreDialog::Name | KScoreDialog::Custom1 | KScoreDialog::Score, this); scoreDialog->addField(KScoreDialog::Custom1, i18n("Par"), "Par"); - scoreDialog->setConfigGroup(info[currentCourse].untranslatedName + QString(" Highscores")); + scoreDialog->setConfigGroup(info[currentCourse].untranslatedName + TQString(" Highscores")); scoreDialog->setComment(i18n("High Scores for %1").arg(info[currentCourse].name)); scoreDialog->show(); } @@ -234,7 +234,7 @@ void NewGameDialog::removeCourse() if (curItem < 0) return; - QString file = *names.at(curItem); + TQString file = *names.at(curItem); if (externCourses.contains(file) < 1) return; @@ -253,11 +253,11 @@ void NewGameDialog::selectionChanged() void NewGameDialog::addCourse() { - QStringList files = KFileDialog::getOpenFileNames(":kourses", QString::fromLatin1("application/x-kourse"), this, i18n("Pick Kolf Course")); + TQStringList files = KFileDialog::getOpenFileNames(":kourses", TQString::fromLatin1("application/x-kourse"), this, i18n("Pick Kolf Course")); bool hasDuplicates = false; - for (QStringList::Iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) + for (TQStringList::Iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) { if (names.contains(*fileIt) > 0) { @@ -289,7 +289,7 @@ void NewGameDialog::addPlayer() editors.append(new PlayerEditor(i18n("Player %1").arg(editors.count() + 1), *startColors.at(editors.count()), layout)); editors.last()->show(); - connect(editors.last(), SIGNAL(deleteEditor(PlayerEditor *)), this, SLOT(deleteEditor(PlayerEditor *))); + connect(editors.last(), TQT_SIGNAL(deleteEditor(PlayerEditor *)), this, TQT_SLOT(deleteEditor(PlayerEditor *))); enableButtons(); } @@ -311,15 +311,15 @@ void NewGameDialog::enableButtons() ///////////////////////// -PlayerEditor::PlayerEditor(QString startName, QColor startColor, QWidget *parent, const char *_name) - : QWidget(parent, _name) +PlayerEditor::PlayerEditor(TQString startName, TQColor startColor, TQWidget *parent, const char *_name) + : TQWidget(parent, _name) { - QHBoxLayout *layout = new QHBoxLayout(this, KDialogBase::spacingHint()); + TQHBoxLayout *layout = new TQHBoxLayout(this, KDialogBase::spacingHint()); - if (!QPixmapCache::find("grass", grass)) + if (!TQPixmapCache::find("grass", grass)) { grass.load(locate("appdata", "pics/grass.png")); - QPixmapCache::insert("grass", grass); + TQPixmapCache::insert("grass", grass); } setBackgroundPixmap(grass); @@ -336,7 +336,7 @@ PlayerEditor::PlayerEditor(QString startName, QColor startColor, QWidget *parent remove->setAutoMask(true); layout->addWidget(remove); remove->setBackgroundPixmap(grass); - connect(remove, SIGNAL(clicked()), this, SLOT(removeMe())); + connect(remove, TQT_SIGNAL(clicked()), this, TQT_SLOT(removeMe())); } void PlayerEditor::removeMe() |