From atlantik-devel Mon Jun 10 06:40:26 2002 From: kde () office ! kde ! org Date: Mon, 10 Jun 2002 06:40:26 +0000 To: atlantik-devel Subject: [atlantik-devel] CVS: kdeaddons/atlantikdesigner/designer designer.cpp,1.37,1.38 editor.cpp,1.24,1.2 X-MARC-Message: https://marc.info/?l=atlantik-devel&m=102369132528304 Update of /home/kde/kdeaddons/atlantikdesigner/designer In directory office:/tmp/cvs-serv12125/designer Modified Files: designer.cpp editor.cpp Log Message: bug fixes Index: designer.cpp =================================================================== RCS file: /home/kde/kdeaddons/atlantikdesigner/designer/designer.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- designer.cpp 2002/06/10 04:08:05 1.37 +++ designer.cpp 2002/06/10 06:40:23 1.38 @@ -37,6 +37,7 @@ { firstBoard = true; + isMod = false; m_player = 0; copiedEstate = 0; editor = 0; @@ -48,8 +49,8 @@ (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..."), 0, this, SLOT(info()), actionCollection(), "boardinfo"); - (void) new KAction(i18n("&Edit Groups..."), 0, this, SLOT(editGroups()), actionCollection(), "groupeditor"); + (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"); @@ -83,11 +84,8 @@ types.append("tax"); types.append("jail"); - isMod = false; openNew(); - doCaption(false); - resize(350, 400); applyMainWindowSettings(KGlobal::config(), "DesignerTopLevelWindow"); } @@ -127,7 +125,10 @@ delete board; delete layout; + KConfig atlantikConfig("atlantikrc"); board = new AtlantikBoard(0, max, AtlantikBoard::Edit, this, "Board"); + board->setViewProperties(false, false, false, atlantikConfig.readBoolEntry("QuartzEffects", true), false); + setCentralWidget(board); layout = new QVBoxLayout(board->centerWidget()); editor = new EstateEdit(&groups, &estates, &cards, board->centerWidget(), "Estate Editor"); @@ -162,8 +163,8 @@ groupsChanged(); updateBackground(); - isMod = false; QTimer::singleShot(500, this, SLOT(setPlayerAtBeginning())); + doCaption(false); } ConfigEstate *AtlanticDesigner::newEstate(int i) @@ -261,7 +262,6 @@ if (s.left(1) == "<") { - //kdDebug() << "setting parsemode for s [" << s << "]" << endl; if (s == "") parseMode = Parse_General; else if (s == "") @@ -411,7 +411,6 @@ key = "goback"; } - //kdDebug() << key << "=" << v << endl; keys.append(key); values.append(v); } @@ -504,12 +503,10 @@ groupsChanged(); updateBackground(); - doCaption(false); updateJumpMenu(); - isMod = false; - QTimer::singleShot(500, this, SLOT(setPlayerAtBeginning())); + doCaption(false); } void AtlanticDesigner::updateJumpMenu() @@ -558,7 +555,6 @@ void AtlanticDesigner::save() { (void) editor->saveEstate(); - //kdDebug() << "count is " << estates.count() << endl; QString oldfilename = filename; if (filename.isNull()) filename = KFileDialog::getOpenFileName(); @@ -591,16 +587,26 @@ t << "bgcolor=" << boardInfo.bgColor.name() << endl; t << endl; - t << QString("[Meta]\nname=%2\ndescription=%3\nurl=%4\nversion=%5\nauthors=%6\ncredits=%7\n").arg(boardInfo.name).arg(boardInfo.description).arg(boardInfo.url).arg(boardInfo.version).arg(boardInfo.authors.join(",")).arg(boardInfo.credits.join(",")); - - t << endl << endl; + t << "[Meta]" << endl; + if (!boardInfo.name.isEmpty()) + t << "name=" << boardInfo.name << endl; + if (!boardInfo.description.isEmpty()) + t << "description=" << boardInfo.description << endl; + if (!boardInfo.url.isEmpty()) + t << "url=" << boardInfo.url << endl; + if (!boardInfo.version.isEmpty()) + t << "version=" << boardInfo.version << endl; + if (!boardInfo.authors.isEmpty()) + t << "authors=" << boardInfo.authors.join(",") << endl; + if (!boardInfo.credits.isEmpty()) + t << "credits=" << boardInfo.credits.join(",") << endl; // now do the cards - t << "" << endl << endl; - for (QValueList::Iterator it = cards.begin(); it != cards.end(); ++it) { + t << endl; + t << "" << endl << endl; t << "groupname=" << (*it).name() << endl; for (CardStack::Iterator cit = (*it).begin(); cit != (*it).end(); ++cit) @@ -636,7 +642,7 @@ } } - t << endl; + t << endl << endl; t << "" << endl; @@ -662,7 +668,7 @@ t << "rentvar=" << (*it).rentVar() << endl; } - t << endl; + t << endl << endl; t << "" << endl; @@ -681,7 +687,7 @@ switch (estate->type()) { case Street: - if (!estate->group().isNull() && estate->group() != i18n("Default")) + if (!estate->group().isNull()) t << "group=" << estate->group() << endl; t << "price=" << estate->price() << endl; @@ -716,12 +722,9 @@ } t << endl; - - //allNames.append(estate->name()); } f.flush(); - isMod = false; doCaption(false); } @@ -733,16 +736,18 @@ void AtlanticDesigner::paste() { ConfigEstate *estate = editor->theEstate(); - estate->setColor(copiedEstate->color()); - estate->setBgColor(copiedEstate->bgColor()); estate->setType(copiedEstate->type()); for (int i = 0; i < 6; i++) estate->setRent(i, copiedEstate->rent(i)); estate->setPrice(copiedEstate->price()); estate->setTax(copiedEstate->tax()); estate->setTaxPercentage(copiedEstate->taxPercentage()); + estate->setGroup(copiedEstate->group()); + estate->setTakeCard(copiedEstate->takeCard()); editor->setEstate(estate); + + groupsChanged(); } void AtlanticDesigner::closeEvent(QCloseEvent *e) @@ -759,9 +764,6 @@ void AtlanticDesigner::changeEstate(int index) { - //kdDebug() << index << endl; - //kdDebug() << "count is " << estates.count() << endl; - (void) editor->saveEstate(); editor->setEstate(estates.at(index)); @@ -802,20 +804,19 @@ estate->setEstateId(i); board->addEstateView(estate); - //kdDebug() << "i is " << i << ", sideLen is " << sideLen << endl; - if ((i%sideLen - 1) == 0 || i == 1) // make a newEstate + if ((i % sideLen - 1) == 0 || i == 1) { - //kdDebug() << "making a new Estate\n"; newEstate(i); } } - isMod = true; updateJumpMenu(); groupsChanged(); updateBackground(); + QTimer::singleShot(500, this, SLOT(setPlayerAtBeginning())); + doCaption(true); } void AtlanticDesigner::smaller() @@ -833,11 +834,9 @@ ConfigEstate *estate = 0; for (int i = 0; i < max; ++i) { - //kdDebug() << "i is " << i << ", sideLen is " << sideLen << endl; + // remove estate if (((i%sideLen - 1) == 0 || i == 1) && remove) - // remove estate { - //kdDebug() << "removing Estate\n"; estates.remove(i); i--; remove = false; @@ -852,22 +851,23 @@ } } - isMod = true; updateJumpMenu(); groupsChanged(); updateBackground(); QTimer::singleShot(500, this, SLOT(setPlayerAtBeginning())); + + doCaption(true); } void AtlanticDesigner::modified() { - isMod = true; doCaption(true); } void AtlanticDesigner::doCaption(bool modified) { - setCaption(filename.isNull()? i18n("Atlantic Gameboard Editor") : filename, modified); + setCaption(filename.isNull()? i18n("Atlantik Gameboard Editor") : filename, modified); + isMod = modified; } void AtlanticDesigner::editGroups() @@ -921,6 +921,7 @@ { BoardInfoDlg *dlg = new BoardInfoDlg(true, &boardInfo, this); connect(dlg, SIGNAL(okClicked()), this, SLOT(updateBackground())); + connect(dlg, SIGNAL(okClicked()), this, SLOT(modified())); dlg->show(); } Index: editor.cpp =================================================================== RCS file: /home/kde/kdeaddons/atlantikdesigner/designer/editor.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- editor.cpp 2002/06/10 04:08:05 1.24 +++ editor.cpp 2002/06/10 06:40:23 1.25 @@ -507,7 +507,7 @@ delete estate; estate = 0; - value = new QSpinBox(0, 1000, 1, this); + value = new QSpinBox(0, 2000, 5, this); hlayout->addWidget(value); connect(value, SIGNAL(valueChanged(int)), this, SLOT(valueChanged(int))); @@ -660,7 +660,7 @@ return; bool ok = false;; - QString name = KLineEditDlg::getText(i18n("Add Card"), i18n("Enter the name of the new card below."), QString::null, &ok, this); + QString name = KLineEditDlg::getText(i18n("Add Card"), i18n("Enter the name of the new card below."), (*stack->at(curItem)).name, &ok, this); if (ok) { (*stack->at(curItem)).name = name; _______________________________________________ atlantik-devel mailing list atlantik-devel@mail.kde.org http://mail.kde.org/mailman/listinfo/atlantik-devel