From atlantik-devel Tue Jun 11 01:39:46 2002 From: kde () office ! kde ! org Date: Tue, 11 Jun 2002 01:39:46 +0000 To: atlantik-devel Subject: [atlantik-devel] CVS: kdeaddons/atlantikdesigner/designer designer.cpp,1.38,1.39 editor.cpp,1.25,1.2 X-MARC-Message: https://marc.info/?l=atlantik-devel&m=102375973626598 Update of /home/kde/kdeaddons/atlantikdesigner/designer In directory office:/tmp/cvs-serv32594/designer Modified Files: designer.cpp editor.cpp group.cpp main.cpp Removed Files: main.h Log Message: fix mem leak, bug fixes Index: designer.cpp =================================================================== RCS file: /home/kde/kdeaddons/atlantikdesigner/designer/designer.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- designer.cpp 2002/06/10 06:40:23 1.38 +++ designer.cpp 2002/06/11 01:39:43 1.39 @@ -36,6 +36,7 @@ AtlanticDesigner::AtlanticDesigner(QWidget *parent, const char *name) : KMainWindow(parent, name) { firstBoard = true; + estates.setAutoDelete(true); isMod = false; m_player = 0; @@ -575,17 +576,21 @@ t << "[Board]" << endl; ConfigEstate *estate = 0; + bool hasGo = false; for (estate = estates.first(); estate; estate = estates.next()) { if (estate->go()) { t << "go=" << estate->estateId() + 1 << endl; + hasGo = true; break; } } + if (!hasGo) + t << "go=1" << endl; - t << "bgcolor=" << boardInfo.bgColor.name() << endl; - t << endl; + if (boardInfo.bgColor.isValid()) + t << "bgcolor=" << boardInfo.bgColor.name() << endl << endl; t << "[Meta]" << endl; if (!boardInfo.name.isEmpty()) @@ -605,7 +610,7 @@ for (QValueList::Iterator it = cards.begin(); it != cards.end(); ++it) { - t << endl; + t << endl << endl; t << "" << endl << endl; t << "groupname=" << (*it).name() << endl; @@ -649,8 +654,21 @@ for (ConfigEstateGroupList::Iterator it = groups.begin(); it != groups.end(); ++it) { if ((*it).name() == i18n("Default")) - continue; + { + bool containsDefault = false; + for (estate = estates.first(); estate; estate = estates.next()) + { + if (estate->group() == i18n("Default")) + { + containsDefault = true; + break; + } + } + if (!containsDefault) + continue; + } + t << endl << QString("[%1]").arg((*it).name()) << endl; if ((*it).housePrice() > 0) t << "houseprice=" << (*it).housePrice() << endl; @@ -659,8 +677,8 @@ if ((*it).fgColor().isValid()) t << "color=" << (*it).fgColor().name() << endl; - - t << "bgcolor=" << (*it).bgColor().name() << endl; + if ((*it).bgColor().isValid()) + t << "bgcolor=" << (*it).bgColor().name() << endl; if (!(*it).rentMath().isEmpty()) t << "rentmath=" << (*it).rentMath() << endl; @@ -674,14 +692,6 @@ for (estate = estates.first(); estate; estate = estates.next()) { - /* - if (!allNames.grep(estate->name()).empty()) - { - KMessageBox::detailedSorry(this, i18n("There are duplicate names on your gameboard. Thus, it can not be saved correctly; aborting."), i18n("%1 (number %1) has a duplicate name.").arg(estate->name()).arg(estate->estateId())); - return; - } - */ - t << endl << QString("[%1]").arg(estate->name()) << endl; switch (estate->type()) @@ -690,7 +700,8 @@ if (!estate->group().isNull()) t << "group=" << estate->group() << endl; - t << "price=" << estate->price() << endl; + if (estate->price() > 0) + t << "price=" << estate->price() << endl; for (int i = 0; i < 6; i++) { @@ -700,8 +711,10 @@ break; case Tax: - t << "tax=" << estate->tax() << endl; - t << "taxpercentage=" << estate->taxPercentage() << endl; + if (estate->tax() > 0) + t << "tax=" << estate->tax() << endl; + if (estate->taxPercentage() > 0) + t << "taxpercentage=" << estate->taxPercentage() << endl; break; case Jail: @@ -720,8 +733,6 @@ t << "freeparking=1" << endl; break; } - - t << endl; } f.flush(); @@ -736,7 +747,6 @@ void AtlanticDesigner::paste() { ConfigEstate *estate = editor->theEstate(); - estate->setType(copiedEstate->type()); for (int i = 0; i < 6; i++) estate->setRent(i, copiedEstate->rent(i)); estate->setPrice(copiedEstate->price()); @@ -744,6 +754,8 @@ estate->setTaxPercentage(copiedEstate->taxPercentage()); estate->setGroup(copiedEstate->group()); estate->setTakeCard(copiedEstate->takeCard()); + estate->setType(copiedEstate->type()); + estate->setName(copiedEstate->name()); editor->setEstate(estate); @@ -764,6 +776,8 @@ void AtlanticDesigner::changeEstate(int index) { + setFocus(); + (void) editor->saveEstate(); editor->setEstate(estates.at(index)); @@ -835,7 +849,7 @@ for (int i = 0; i < max; ++i) { // remove estate - if (((i%sideLen - 1) == 0 || i == 1) && remove) + if (((i % sideLen - 1) == 0 || i == 1) && remove) { estates.remove(i); i--; Index: editor.cpp =================================================================== RCS file: /home/kde/kdeaddons/atlantikdesigner/designer/editor.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- editor.cpp 2002/06/10 06:40:23 1.25 +++ editor.cpp 2002/06/11 01:39:43 1.26 @@ -151,7 +151,7 @@ connect(this, SIGNAL(somethingChanged()), this, SLOT(saveEstate())); - layout = new QGridLayout(this, 5, 1, KDialog::marginHint(), KDialog::spacingHint()); + layout = new QGridLayout(this, 6, 1, KDialog::marginHint(), KDialog::spacingHint()); nameEdit = new QLineEdit(this, "Name Edit"); layout->addWidget(nameEdit, 0, 0); connect(nameEdit, SIGNAL(returnPressed()), this, SIGNAL(somethingChanged())); @@ -160,8 +160,10 @@ layout->setRowStretch(2, 2); + layout->addWidget(new KSeparator(this), 3, 0); + QHBoxLayout *typeLayout = new QHBoxLayout(KDialog::spacingHint()); - layout->addLayout(typeLayout, 3, 0); + layout->addLayout(typeLayout, 4, 0); QLabel *typeLabel = new QLabel(i18n("Type"), this); typeLayout->addWidget(typeLabel); @@ -172,7 +174,7 @@ goCheck = new QCheckBox(i18n("This estate is Go"), this); connect(goCheck, SIGNAL(toggled(bool)), this, SIGNAL(somethingChanged())); - layout->addWidget(goCheck, 4, 0); + layout->addWidget(goCheck, 5, 0); QStringList estateTypes(i18n("Street")); estateTypes.append(i18n("Cards")); Index: group.cpp =================================================================== RCS file: /home/kde/kdeaddons/atlantikdesigner/designer/group.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- group.cpp 2002/06/10 04:08:05 1.3 +++ group.cpp 2002/06/11 01:39:43 1.4 @@ -192,7 +192,11 @@ { ConfigEstateGroup *group = currentGroup(); if (group) + { group->setRentMath(newValue); + if (group->rentVar().isEmpty()) + group->setRentVar(rentVarCombo->currentText()); + } } void GroupEditor::slotApply() @@ -219,3 +223,4 @@ removeB->setEnabled(issel); } +#include "group.moc" Index: main.cpp =================================================================== RCS file: /home/kde/kdeaddons/atlantikdesigner/designer/main.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- main.cpp 2002/03/16 15:48:18 1.2 +++ main.cpp 2002/06/11 01:39:43 1.3 @@ -3,22 +3,22 @@ #include #include -#include "main.h" #include "designer.h" int main(int argc, char *argv[]) { KAboutData aboutData( - "atlantikdesigner", - I18N_NOOP("Atlantik Designer"), ATLANTIKDESIGNER_VERSION_STRING, - I18N_NOOP("Atlantik gameboard designer"), - KAboutData::License_GPL, - I18N_NOOP("(c) 2002 Jason Katz-Brown"), - I18N_NOOP("Gameboard designer for Atlantik."), - "http://capsi.com/atlantik/" - ); + "atlantikdesigner", + I18N_NOOP("Atlantik Designer"), "1.0", + I18N_NOOP("Atlantik gameboard designer"), + KAboutData::License_GPL, + I18N_NOOP("(c) 2002 Jason Katz-Brown"), + 0, + "http://www.unixcode.org/atlantik/" + ); aboutData.addAuthor("Jason Katz-Brown", I18N_NOOP("main author"), "jason@katzbrown.com", "http://katzbrown.com/"); + aboutData.addAuthor("Rob Kaper", I18N_NOOP("libatlantikui"), "cap@capsi.com", "http://capsi.com/"); KCmdLineArgs::init(argc, argv, &aboutData); @@ -34,3 +34,4 @@ return kapplication.exec(); } + --- main.h DELETED --- _______________________________________________ atlantik-devel mailing list atlantik-devel@mail.kde.org http://mail.kde.org/mailman/listinfo/atlantik-devel