diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:22:56 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:22:56 +0000 |
commit | 7346aee26bf190a7e70333c40fab4caca847cd27 (patch) | |
tree | 4b019b434f88dcc3eeaafe1d3f26240b4c4718e8 /atlantikdesigner/designer/designer.cpp | |
parent | 23a3d3aa5b44cbdf305495919866d9dbf4f6da54 (diff) | |
download | tdeaddons-7346aee26bf190a7e70333c40fab4caca847cd27.tar.gz tdeaddons-7346aee26bf190a7e70333c40fab4caca847cd27.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1157634 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'atlantikdesigner/designer/designer.cpp')
-rw-r--r-- | atlantikdesigner/designer/designer.cpp | 178 |
1 files changed, 89 insertions, 89 deletions
diff --git a/atlantikdesigner/designer/designer.cpp b/atlantikdesigner/designer/designer.cpp index 11da0e3..87b548d 100644 --- a/atlantikdesigner/designer/designer.cpp +++ b/atlantikdesigner/designer/designer.cpp @@ -1,17 +1,17 @@ -#include <qcolor.h> -#include <qpalette.h> -#include <qevent.h> -#include <qfile.h> -#include <qguardedptr.h> -#include <qlayout.h> -#include <qpoint.h> -#include <qpopupmenu.h> -#include <qptrlist.h> -#include <qstring.h> -#include <qtextcodec.h> -#include <qtextstream.h> -#include <qtimer.h> -#include <qwidget.h> +#include <tqcolor.h> +#include <tqpalette.h> +#include <tqevent.h> +#include <tqfile.h> +#include <tqguardedptr.h> +#include <tqlayout.h> +#include <tqpoint.h> +#include <tqpopupmenu.h> +#include <tqptrlist.h> +#include <tqstring.h> +#include <tqtextcodec.h> +#include <tqtextstream.h> +#include <tqtimer.h> +#include <tqwidget.h> #include <kaction.h> #include <kapplication.h> @@ -35,7 +35,7 @@ #include "editor.h" #include "designer.h" -AtlanticDesigner::AtlanticDesigner(QWidget *parent, const char *name) +AtlanticDesigner::AtlanticDesigner(TQWidget *parent, const char *name) : KMainWindow(parent, name) { firstBoard = true; @@ -48,35 +48,35 @@ AtlanticDesigner::AtlanticDesigner(QWidget *parent, const char *name) board = 0; layout = 0; - (void) KStdAction::quit(this, SLOT(close()), actionCollection()); - (void) KStdAction::open(this, SLOT(open()), actionCollection()); - (void) KStdAction::openNew(this, SLOT(openNew()), actionCollection()); - (void) KStdAction::save(this, SLOT(save()), actionCollection()); - (void) KStdAction::saveAs(this, SLOT(saveAs()), actionCollection()); - (void) new KAction(i18n("&Edit Gameboard Info..."), CTRL+Key_I, this, SLOT(info()), actionCollection(), "boardinfo"); - (void) new KAction(i18n("&Edit Groups..."), CTRL+Key_G, this, SLOT(editGroups()), actionCollection(), "groupeditor"); - - (void) new KAction(i18n("&Add 4 Squares"), "viewmag+", 0, this, SLOT(larger()), actionCollection(), "larger"); - (void) new KAction(i18n("&Remove 4 Squares"), "viewmag-", 0, this, SLOT(smaller()), actionCollection(), "smaller"); - (void) KStdAction::copy(this, SLOT(copy()), actionCollection()); - (void) KStdAction::paste(this, SLOT(paste()), actionCollection()); - (void) new KAction(i18n("&Up"), Key_Up, this, SLOT(up()), actionCollection(), "up"); - (void) new KAction(i18n("&Down"), Key_Down, this, SLOT(down()), actionCollection(), "down"); - (void) new KAction(i18n("&Left"), Key_Left, this, SLOT(left()), actionCollection(), "left"); - (void) new KAction(i18n("&Right"), Key_Right, this, SLOT(right()), actionCollection(), "right"); + (void) KStdAction::quit(this, TQT_SLOT(close()), actionCollection()); + (void) KStdAction::open(this, TQT_SLOT(open()), actionCollection()); + (void) KStdAction::openNew(this, TQT_SLOT(openNew()), actionCollection()); + (void) KStdAction::save(this, TQT_SLOT(save()), actionCollection()); + (void) KStdAction::saveAs(this, TQT_SLOT(saveAs()), actionCollection()); + (void) new KAction(i18n("&Edit Gameboard Info..."), CTRL+Key_I, this, TQT_SLOT(info()), actionCollection(), "boardinfo"); + (void) new KAction(i18n("&Edit Groups..."), CTRL+Key_G, this, TQT_SLOT(editGroups()), actionCollection(), "groupeditor"); + + (void) new KAction(i18n("&Add 4 Squares"), "viewmag+", 0, this, TQT_SLOT(larger()), actionCollection(), "larger"); + (void) new KAction(i18n("&Remove 4 Squares"), "viewmag-", 0, this, TQT_SLOT(smaller()), actionCollection(), "smaller"); + (void) KStdAction::copy(this, TQT_SLOT(copy()), actionCollection()); + (void) KStdAction::paste(this, TQT_SLOT(paste()), actionCollection()); + (void) new KAction(i18n("&Up"), Key_Up, this, TQT_SLOT(up()), actionCollection(), "up"); + (void) new KAction(i18n("&Down"), Key_Down, this, TQT_SLOT(down()), actionCollection(), "down"); + (void) new KAction(i18n("&Left"), Key_Left, this, TQT_SLOT(left()), actionCollection(), "left"); + (void) new KAction(i18n("&Right"), Key_Right, this, TQT_SLOT(right()), actionCollection(), "right"); recentAct = KStdAction::openRecent(0, 0, actionCollection()); - connect(recentAct, SIGNAL(urlSelected(const KURL &)), this, SLOT(openRecent(const KURL &))); + connect(recentAct, TQT_SIGNAL(urlSelected(const KURL &)), this, TQT_SLOT(openRecent(const KURL &))); recentAct->loadEntries(KGlobal::config(), "Designer recent files"); estateAct = new KListAction(i18n("Change Estate"), 0, 0, 0, actionCollection(), "estate_num"); - connect(estateAct, SIGNAL(activated(int)), SLOT(changeEstate(int))); + connect(estateAct, TQT_SIGNAL(activated(int)), TQT_SLOT(changeEstate(int))); createGUI("atlantikdesignerui.rc"); KConfig *config = kapp->config(); config->setGroup("General"); - QColor defaultColor = colorGroup().background(); + TQColor defaultColor = colorGroup().background(); defaultBg = config->readColorEntry("alternateBackground", &defaultColor); config->setGroup("WM"); defaultColor = colorGroup().dark(); @@ -135,11 +135,11 @@ void AtlanticDesigner::initBoard() board = new AtlantikBoard(0, max, AtlantikBoard::Edit, this, "Board"); setCentralWidget(board); - layout = new QVBoxLayout(board->centerWidget()); + layout = new TQVBoxLayout(board->centerWidget()); editor = new EstateEdit(&groups, &estates, &cards, board->centerWidget(), "Estate Editor"); - connect(editor, SIGNAL(goChecked(int)), this, SLOT(goChanged(int))); - connect(editor, SIGNAL(updateBackground()), this, SLOT(updateBackground())); - connect(editor, SIGNAL(resized()), board, SLOT(slotResizeAftermath())); + connect(editor, TQT_SIGNAL(goChecked(int)), this, TQT_SLOT(goChanged(int))); + connect(editor, TQT_SIGNAL(updateBackground()), this, TQT_SLOT(updateBackground())); + connect(editor, TQT_SIGNAL(resized()), board, TQT_SLOT(slotResizeAftermath())); layout->addWidget(editor); editor->setReady(false); @@ -159,14 +159,14 @@ void AtlanticDesigner::initToken() board->addToken(m_player); - connect(m_player, SIGNAL(changed(Player *)), board, SLOT(playerChanged(Player *))); + connect(m_player, TQT_SIGNAL(changed(Player *)), board, TQT_SLOT(playerChanged(Player *))); } void AtlanticDesigner::openNew() { if (warnClose()) return; - filename = QString::null; + filename = TQString::null; max = 40; @@ -184,7 +184,7 @@ void AtlanticDesigner::openNew() groupsChanged(); updateBackground(); - QTimer::singleShot(500, this, SLOT(setPlayerAtBeginning())); + TQTimer::singleShot(500, this, TQT_SLOT(setPlayerAtBeginning())); doCaption(false); } @@ -198,8 +198,8 @@ ConfigEstate *AtlanticDesigner::newEstate(int i) estate->setChanged(false); estates.insert(i, estate); - connect(estate, SIGNAL(LMBClicked(Estate *)), this, SLOT(changeEstate(Estate *))); - connect(estate, SIGNAL(changed()), this, SLOT(modified())); + connect(estate, TQT_SIGNAL(LMBClicked(Estate *)), this, TQT_SLOT(changeEstate(Estate *))); + connect(estate, TQT_SIGNAL(changed()), this, TQT_SLOT(modified())); board->addEstateView(estate); @@ -254,19 +254,19 @@ void AtlanticDesigner::openRecent(const KURL &url) } } -void AtlanticDesigner::openFile(const QString &filename) +void AtlanticDesigner::openFile(const TQString &filename) { enum ParseMode { Parse_Nothing, Parse_General, Parse_Board, Parse_Cards, Parse_EstateGroups, Parse_Estates }; - QFile f(filename); + TQFile f(filename); if (!f.open(IO_ReadOnly)) return; initMembers(); - QTextStream t(&f); - t.setCodec(QTextCodec::codecForName("utf8")); + TQTextStream t(&f); + t.setCodec(TQTextCodec::codecForName("utf8")); - QString s = t.readLine(); + TQString s = t.readLine(); int parseMode = Parse_Nothing; CardStack *curCardStack = 0; @@ -283,7 +283,7 @@ void AtlanticDesigner::openFile(const QString &filename) continue; } - QString name; + TQString name; if (s.left(1) == "<") { @@ -306,8 +306,8 @@ void AtlanticDesigner::openFile(const QString &filename) int eqSign = s.find("="); if (eqSign >= 0) { - QString key = s.left(eqSign); - QString value = s.right(s.length() - eqSign - 1); + TQString key = s.left(eqSign); + TQString value = s.right(s.length() - eqSign - 1); if (parseMode == Parse_Cards) { @@ -328,9 +328,9 @@ void AtlanticDesigner::openFile(const QString &filename) else if (key == "url") boardInfo.url = value; else if (key == "authors") - boardInfo.authors = QStringList::split(",", value); + boardInfo.authors = TQStringList::split(",", value); else if (key == "credits") - boardInfo.credits = QStringList::split(",", value); + boardInfo.credits = TQStringList::split(",", value); } else if (parseMode == Parse_Board) { @@ -352,23 +352,23 @@ void AtlanticDesigner::openFile(const QString &filename) // for estates int type = FreeParking; - QString group, takeCard; + TQString group, takeCard; int price = -1; int rent[6] = {-1, -1, -1, -1, -1, -1}; int tax = -1; int taxPercentage = -1; int passMoney = -1; - QColor forceBg; + TQColor forceBg; // for groups - QColor color, bgColor; - QString rentMath; + TQColor color, bgColor; + TQString rentMath; int housePrice = -1; int globalPrice = -1; // for cards - QStringList keys; - QValueList<int> values; + TQStringList keys; + TQValueList<int> values; while (true) { @@ -384,8 +384,8 @@ void AtlanticDesigner::openFile(const QString &filename) if (eqSign < 0) continue; - QString key = s.left(eqSign); - QString value = s.right(s.length() - eqSign - 1); + TQString key = s.left(eqSign); + TQString value = s.right(s.length() - eqSign - 1); //////////////////////////////// ESTATES if (parseMode == Parse_Estates) @@ -424,7 +424,7 @@ void AtlanticDesigner::openFile(const QString &filename) type = Cards; } else if (key == "bgcolor") - forceBg = QColor(value); + forceBg = TQColor(value); else if (key == "passmoney") passMoney = value.toInt(); } @@ -486,8 +486,8 @@ void AtlanticDesigner::openFile(const QString &filename) estate->setPassMoney(passMoney); estates.append(estate); - connect(estate, SIGNAL(LMBClicked(Estate *)), this, SLOT(changeEstate(Estate *))); - connect(estate, SIGNAL(changed()), this, SLOT(modified())); + connect(estate, TQT_SIGNAL(LMBClicked(Estate *)), this, TQT_SLOT(changeEstate(Estate *))); + connect(estate, TQT_SIGNAL(changed()), this, TQT_SLOT(modified())); i++; } else if (parseMode == Parse_Cards) @@ -545,15 +545,15 @@ void AtlanticDesigner::openFile(const QString &filename) updateBackground(); updateJumpMenu(); - QTimer::singleShot(500, this, SLOT(setPlayerAtBeginning())); + TQTimer::singleShot(500, this, TQT_SLOT(setPlayerAtBeginning())); doCaption(false); } void AtlanticDesigner::updateJumpMenu() { - QStringList estates; + TQStringList estates; for (int i = 1; i <= max; i++) - estates.append(i18n("Jump to Estate %1").arg(QString::number(i))); + estates.append(i18n("Jump to Estate %1").arg(TQString::number(i))); estateAct->setItems(estates); } @@ -573,8 +573,8 @@ void AtlanticDesigner::setPlayerAtBeginning() void AtlanticDesigner::saveAs() { - QString oldfilename = filename; - filename = QString::null; + TQString oldfilename = filename; + filename = TQString::null; save(); @@ -590,7 +590,7 @@ void AtlanticDesigner::saveAs() void AtlanticDesigner::save() { (void) editor->saveEstate(); - QString oldfilename = filename; + TQString oldfilename = filename; if (filename.isNull()) filename = KFileDialog::getOpenFileName(); @@ -600,12 +600,12 @@ void AtlanticDesigner::save() return; } - QFile f(filename); + TQFile f(filename); if (!f.open(IO_WriteOnly)) return; - QTextStream t(&f); - t.setCodec(QTextCodec::codecForName("utf8")); + TQTextStream t(&f); + t.setCodec(TQTextCodec::codecForName("utf8")); t << "<General>" << endl << endl; if (!boardInfo.name.isEmpty()) @@ -654,7 +654,7 @@ void AtlanticDesigner::save() t << "<EstateGroups>" << endl; // double-prevent duplicates - QStringList writtenGroups; + TQStringList writtenGroups; for (ConfigEstateGroupList::Iterator it = groups.begin(); it != groups.end(); ++it) { @@ -679,7 +679,7 @@ void AtlanticDesigner::save() writtenGroups.append((*it).name()); - t << endl << QString("[%1]").arg((*it).name()) << endl; + t << endl << TQString("[%1]").arg((*it).name()) << endl; if ((*it).globalPrice() > 0) t << "price=" << (*it).globalPrice() << endl; @@ -698,7 +698,7 @@ void AtlanticDesigner::save() // now do the cards - for (QValueList<CardStack>::Iterator it = cards.begin(); it != cards.end(); ++it) + for (TQValueList<CardStack>::Iterator it = cards.begin(); it != cards.end(); ++it) { t << endl << endl; t << "<Cards>" << endl << endl; @@ -707,10 +707,10 @@ void AtlanticDesigner::save() for (CardStack::Iterator cit = (*it).begin(); cit != (*it).end(); ++cit) { t << endl << "[" << (*cit).name << "]" << endl; - QValueList<int>::Iterator vit = (*cit).values.begin(); - for (QStringList::Iterator it = (*cit).keys.begin(); it != (*cit).keys.end(); ++it, ++vit) + TQValueList<int>::Iterator vit = (*cit).values.begin(); + for (TQStringList::Iterator it = (*cit).keys.begin(); it != (*cit).keys.end(); ++it, ++vit) { - QString key = (*it); + TQString key = (*it); int value = (*vit); if (key == "collect") @@ -748,7 +748,7 @@ void AtlanticDesigner::save() for (estate = estates.first(); estate; estate = estates.next()) { - t << endl << QString("[%1]").arg(estate->name()) << endl; + t << endl << TQString("[%1]").arg(estate->name()) << endl; switch (estate->type()) { @@ -828,7 +828,7 @@ void AtlanticDesigner::paste() groupsChanged(); } -void AtlanticDesigner::closeEvent(QCloseEvent *e) +void AtlanticDesigner::closeEvent(TQCloseEvent *e) { if (warnClose()) return; @@ -895,7 +895,7 @@ void AtlanticDesigner::larger() groupsChanged(); updateBackground(); - QTimer::singleShot(500, this, SLOT(setPlayerAtBeginning())); + TQTimer::singleShot(500, this, TQT_SLOT(setPlayerAtBeginning())); doCaption(true); } @@ -934,7 +934,7 @@ void AtlanticDesigner::smaller() updateJumpMenu(); groupsChanged(); updateBackground(); - QTimer::singleShot(500, this, SLOT(setPlayerAtBeginning())); + TQTimer::singleShot(500, this, TQT_SLOT(setPlayerAtBeginning())); doCaption(true); } @@ -957,9 +957,9 @@ void AtlanticDesigner::editGroups() groupEditor = new GroupEditor(&groups, this); groupEditor->show(); - connect(groupEditor, SIGNAL(changed()), this, SLOT(modified())); - connect(groupEditor, SIGNAL(update()), this, SLOT(groupsChanged())); - connect(groupEditor, SIGNAL(update()), editor, SLOT(groupsChanged())); + connect(groupEditor, TQT_SIGNAL(changed()), this, TQT_SLOT(modified())); + connect(groupEditor, TQT_SIGNAL(update()), this, TQT_SLOT(groupsChanged())); + connect(groupEditor, TQT_SIGNAL(update()), editor, TQT_SLOT(groupsChanged())); } else groupEditor->raise(); @@ -998,7 +998,7 @@ void AtlanticDesigner::updateBackground() { if (curEstate->type() != Street || (curEstate->type() == Street && curEstate->group().isNull())) { - curEstate->setColor(QColor()); + curEstate->setColor(TQColor()); curEstate->setBgColor(boardInfo.bgColor); } @@ -1019,8 +1019,8 @@ void AtlanticDesigner::info() boardInfoDlg = new BoardInfoDlg(true, &boardInfo, this, "Board Information", false); boardInfoDlg->show(); - connect(boardInfoDlg, SIGNAL(okClicked()), this, SLOT(updateBackground())); - connect(boardInfoDlg, SIGNAL(okClicked()), this, SLOT(modified())); + connect(boardInfoDlg, TQT_SIGNAL(okClicked()), this, TQT_SLOT(updateBackground())); + connect(boardInfoDlg, TQT_SIGNAL(okClicked()), this, TQT_SLOT(modified())); } else boardInfoDlg->raise(); |