You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdeaddons/atlantikdesigner/designer/editor.cpp

939 lines
21 KiB

#include <tqcheckbox.h>
#include <tqevent.h>
#include <tqframe.h>
#include <tqhgroupbox.h>
#include <tqlabel.h>
#include <tqlayout.h>
#include <tqlineedit.h>
#include <tqspinbox.h>
#include <tqstringlist.h>
#include <tqvaluelist.h>
#include <tqvbox.h>
#include <tqvgroupbox.h>
#include <kcolorbutton.h>
#include <kcombobox.h>
#include <kdebug.h>
#include <kdialog.h>
#include <kdialogbase.h>
#include <klineeditdlg.h>
#include <tdelistbox.h>
#include <tdelocale.h>
#include <tdemessagebox.h>
#include <kpushbutton.h>
#include <kseparator.h>
#include <atlantic/estate.h>
#include "editor.h"
ConfigEstate::ConfigEstate(int estateId) : Estate(estateId)
{
m_rent[0] = m_rent[1] = m_rent[2] = m_rent[3] = m_rent[4] = m_rent[5] = 0;
m_type = m_price = m_tax = m_taxPercentage = m_passMoney = 0;
m_go = false;
m_group = "Default";
m_changed = false;
}
void ConfigEstate::setChanged(bool b)
{
m_changed = b;
}
void ConfigEstate::setEstateId(const int estateId)
{
if (m_id != estateId)
{
m_id = estateId;
m_changed = true;
}
}
void ConfigEstate::setType(const int type)
{
if (m_type != type)
{
m_type = type;
m_changed = true;
}
}
void ConfigEstate::setGroup(const TQString &group)
{
if (m_group != group)
{
m_group = group;
m_changed = true;
}
}
void ConfigEstate::setPrice(int price)
{
if (m_price != price)
{
m_price = price;
m_changed = true;
}
}
void ConfigEstate::setRent(const int houses, const int rent)
{
if (m_rent[houses] != rent)
{
m_rent[houses] = rent;
m_changed = true;
}
}
void ConfigEstate::setTax(const int tax)
{
if (m_tax != tax)
{
m_tax = tax;
m_changed = true;
}
}
void ConfigEstate::setTaxPercentage(const int taxPercentage)
{
if (m_taxPercentage != taxPercentage)
{
m_taxPercentage = taxPercentage;
m_changed = true;
}
}
void ConfigEstate::setTakeCard(const TQString &takeCard)
{
if (m_takeCard != takeCard)
{
m_takeCard = takeCard;
m_changed = true;
}
}
void ConfigEstate::setForceBg(const TQColor &forceBg)
{
if (m_forceBg != forceBg)
{
m_forceBg = forceBg;
m_changed = true;
}
}
void ConfigEstate::setGo(const bool go)
{
if (m_go != go)
{
m_go = go;
m_changed = true;
}
}
void ConfigEstate::setPassMoney(const int passMoney)
{
if (m_passMoney != passMoney)
{
m_passMoney = passMoney;
m_changed = true;
}
}
///////////////////////////
TQStringList types;
EstateEdit::EstateEdit(ConfigEstateGroupList *newGroups, EstateList *estates, TQValueList<CardStack> *cards, TQWidget *parent, const char *name)
: TQWidget(parent, name)
{
groups = newGroups;
types.append("pay");
types.append("payeach");
types.append("collect");
types.append("collecteach");
types.append("advanceto");
types.append("advance");
types.append("goback");
types.append("tojail");
types.append("outofjail");
types.append("nextutil");
types.append("nextrr");
types.append("payhouse");
types.append("payhotel");
oldType = -1;
estate = 0;
this->cards = cards;
this->estates = estates;
ready = false;
locked = false;
connect(this, TQ_SIGNAL(somethingChanged()), this, TQ_SLOT(saveEstate()));
layout = new TQGridLayout(this, 7, 1, KDialog::marginHint(), KDialog::spacingHint());
nameEdit = new TQLineEdit(this, "Name Edit");
layout->addWidget(nameEdit, 0, 0);
connect(nameEdit, TQ_SIGNAL(returnPressed()), this, TQ_SIGNAL(somethingChanged()));
confDlg = 0;
layout->setRowStretch(2, 2);
layout->addWidget(new KSeparator(this), 3, 0);
TQHBoxLayout *typeLayout = new TQHBoxLayout(KDialog::spacingHint());
layout->addLayout(typeLayout, 4, 0);
TQLabel *typeLabel = new TQLabel(i18n("Type:"), this);
typeLayout->addWidget(typeLabel);
typeCombo = new KComboBox(false, this, "Type Combo");
typeLayout->addWidget(typeCombo);
connect(typeCombo, TQ_SIGNAL(activated(int)), this, TQ_SIGNAL(somethingChanged()));
connect(typeCombo, TQ_SIGNAL(activated(int)), this, TQ_SIGNAL(updateBackground()));
goCheck = new TQCheckBox(i18n("This estate is 'Go'"), this);
connect(goCheck, TQ_SIGNAL(toggled(bool)), this, TQ_SIGNAL(somethingChanged()));
connect(goCheck, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(goToggled(bool)));
layout->addWidget(goCheck, 5, 0);
TQHBoxLayout *passMoneyLayout = new TQHBoxLayout(KDialog::spacingHint());
layout->addLayout(passMoneyLayout, 6, 0);
TQLabel *passMoneyLabel = new TQLabel(i18n("Pass money:"), this);
passMoneyLayout->addWidget(passMoneyLabel);
passMoney = new TQSpinBox(0, 3000, 10, this);
passMoney->setSpecialValueText(i18n("None"));
passMoney->setSuffix("$");
passMoneyLayout->addWidget(passMoney);
TQStringList estateTypes(i18n("Street"));
estateTypes.append(i18n("Cards"));
estateTypes.append(i18n("Free Parking"));
estateTypes.append(i18n("Go to Jail"));
estateTypes.append(i18n("Tax"));
estateTypes.append(i18n("Jail"));
typeCombo->insertStringList(estateTypes);
}
void EstateEdit::aboutToDie()
{
delete confDlg;
confDlg = 0;
}
void EstateEdit::setReady(bool ready)
{
this->ready = ready;
}
void EstateEdit::resizeEvent(TQResizeEvent *)
{
emit resized();
}
void EstateEdit::setEstate(ConfigEstate *_estate)
{
if (!_estate)
return;
// why the hell is this here? :-)
while (1)
if (!locked)
break;
estate = _estate;
ready = false;
nameEdit->setText(estate->name());
typeCombo->setCurrentItem(estate->type());
goCheck->setChecked(estate->go());
passMoney->setValue(estate->passMoney());
ready = true;
saveEstate(true);
}
ConfigEstate *EstateEdit::saveEstate(bool superficial)
{
if (!estate || !ready)
return 0;
locked = true;
EstateType curType = (EstateType)typeCombo->currentItem();
if (!superficial)
{
confDlg->slotOk();
estate->setType(curType);
estate->setName(nameEdit->text());
estate->setGo(goCheck->isChecked());
estate->setPassMoney(passMoney->value());
}
if (curType != Street)
{
}
if (!superficial)
estate->update();
configure();
locked = false;
return estate;
}
void EstateEdit::configure()
{
if (oldType == typeCombo->currentItem())
{
confDlg->slotUpdate(estate);
return;
}
delete confDlg;
switch (estate->type())
{
case Street:
confDlg = new StreetDlg(groups, this);
break;
case Tax:
confDlg = new TaxDlg(this);
break;
case Cards:
confDlg = new CardsDlg(estates, cards, this);
break;
case Jail:
case ToJail:
case FreeParking:
confDlg = new GenericDlg(this);
break;
default:
confDlg = new EstateDlg(this);
break;
}
confDlg->slotUpdate(estate);
connect(confDlg, TQ_SIGNAL(updateBackground()), this, TQ_SIGNAL(updateBackground()));
layout->addWidget(confDlg, 1, 0);
confDlg->show();
oldType = typeCombo->currentItem();
}
void EstateEdit::groupsChanged()
{
confDlg->groupsChanged();
}
void EstateEdit::goToggled(bool on)
{
if (on)
{
emit goChecked(estate->id());
}
}
bool EstateEdit::upArrow()const
{
return (nameEdit->hasFocus() || typeCombo->hasFocus());
}
bool EstateEdit::downArrow()const
{
return upArrow();
}
bool EstateEdit::leftArrow()const
{
if (nameEdit->hasFocus())
{
nameEdit->setCursorPosition(nameEdit->cursorPosition() - 1);
return true;
}
return false;
}
bool EstateEdit::rightArrow()const
{
if (nameEdit->hasFocus())
{
nameEdit->setCursorPosition(nameEdit->cursorPosition() + 1);
return true;
}
return false;
}
/////////////////////////////////
TaxDlg::TaxDlg(TQWidget *parent, char *name)
: EstateDlg(parent, name)
{
TQGridLayout *taxBox = new TQGridLayout(this, 2, 2, KDialog::marginHint(), KDialog::spacingHint());
taxBox->addWidget(new TQLabel(i18n("Fixed tax:"), this), 0, 0);
taxBox->addWidget(tax = new TQSpinBox(0, 3000, 1, this), 0, 1);
tax->setSpecialValueText(i18n("None"));
tax->setSuffix("$");
taxBox->addWidget(new TQLabel(i18n("Percentage tax:"), this), 1, 0);
taxBox->addWidget(taxPercentage = new TQSpinBox(0, 100, 1, this), 1, 1);
taxPercentage->setSpecialValueText(i18n("None"));
taxPercentage->setSuffix("%");
}
void TaxDlg::save()
{
estate->setTax(tax->value());
estate->setTaxPercentage(taxPercentage->value());
}
void TaxDlg::update()
{
tax->setValue(estate->tax());
taxPercentage->setValue(estate->taxPercentage());
}
/////////////////////////////////
GenericDlg::GenericDlg(TQWidget *parent, char *name)
: EstateDlg(parent, name)
{
TQHBoxLayout *layout = new TQHBoxLayout(this, KDialog::spacingHint());
layout->addWidget(new TQLabel(i18n("Background:"), this));
col = new KColorButton(this);
layout->addWidget(col);
}
void GenericDlg::save()
{
estate->setForceBg(col->color());
emit updateBackground();
}
void GenericDlg::update()
{
col->setColor(estate->forceBg());
}
/////////////////////////////////
CardsDlg::CardsDlg(EstateList *newEstates, TQValueList<CardStack> *newCards, TQWidget *parent, char *name)
: EstateDlg(parent, name)
{
estates = newEstates;
stacks = newCards;
view = 0;
vlayout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint());
TQHBoxLayout *layout = new TQHBoxLayout(vlayout, KDialog::spacingHint());
KPushButton *addB = new KPushButton(i18n("&New Stack"), this);
connect(addB, TQ_SIGNAL(clicked()), this, TQ_SLOT(addStack()));
layout->addWidget(addB);
layout->addStretch();
layout->addWidget(new TQLabel(i18n("Cards from"), this));
TQStringList cardNames;
for (TQValueList<CardStack>::Iterator it = stacks->begin(); it != stacks->end(); ++it)
cardNames.append((*it).name());
cards = new TQComboBox(this);
cards->insertStringList(cardNames);
layout->addWidget(cards);
connect(cards, TQ_SIGNAL(activated(const TQString &)), this, TQ_SLOT(updateView(const TQString &)));
vlayout->addWidget(new KSeparator(this));
}
void CardsDlg::addStack()
{
bool ok;
TQString name = KLineEditDlg::getText(i18n("Add Stack"), i18n("Enter the name of the new stack:"), TQString(), &ok, this);
if (ok)
{
for (TQValueList<CardStack>::Iterator it = stacks->begin(); it != stacks->end(); ++it)
{
if ((*it).name() == name)
{
KMessageBox::information(this, i18n("That name is already on the list."));
return;
}
}
stacks->append(CardStack(name));
cards->insertItem(name);
cards->setCurrentText(name);
updateView(name);
}
}
void CardsDlg::updateView(const TQString &curName)
{
CardStack *curStack = 0;
for (TQValueList<CardStack>::Iterator it = stacks->begin(); it != stacks->end(); ++it)
if ((*it).name() == curName)
curStack = &(*it);
if (!curStack)
return;
delete view;
view = new CardView(estates, curStack, this);
vlayout->addWidget(view);
view->show();
}
void CardsDlg::save()
{
estate->setTakeCard(cards->currentText());
}
void CardsDlg::update()
{
if (!estate->takeCard().isNull())
{
cards->setCurrentText(estate->takeCard());
updateView(estate->takeCard());
}
else
cards->setCurrentItem(-1);
}
/////////////////////////////////
ChooseWidget::ChooseWidget(EstateList *estates, int id, Card *card, TQWidget *parent, char *name)
: TQWidget (parent, name)
{
this->id = id;
this->card = card;
this->estates = estates;
value = 0;
estate = 0;
number = true;
prevNumber = true;
init = true;
value = 0;
hlayout = new TQHBoxLayout(this, KDialog::spacingHint());
typeCombo = new KComboBox(this);
TQStringList _types(i18n("Pay"));
_types.append(i18n("Pay Each Player"));
_types.append(i18n("Collect"));
_types.append(i18n("Collect From Each Player"));
_types.append(i18n("Advance To"));
_types.append(i18n("Advance"));
_types.append(i18n("Go Back"));
_types.append(i18n("Go to Jail"));
_types.append(i18n("Get out of Jail Free Card"));
_types.append(i18n("Advance to Nearest Utility"));
_types.append(i18n("Advance to Nearest Railroad"));
_types.append(i18n("Pay for Each House"));
_types.append(i18n("Pay for Each Hotel"));
typeCombo->insertStringList(_types);
hlayout->addWidget(typeCombo);
connect(typeCombo, TQ_SIGNAL(activated(int)), this, TQ_SLOT(typeChanged(int)));
hlayout->addStretch();
}
void ChooseWidget::valueChanged(int i)
{
if (!value)
return;
(*card->values.at(id)) = i;
value->setValue(i);
}
void ChooseWidget::estateChanged(int i)
{
if (!estate)
return;
(*card->values.at(id)) = i;
estate->setCurrentItem(i);
}
void ChooseWidget::typeChanged(int i)
{
TQString key = (*types.at(i));
(*card->keys.at(id)) = key;
typeCombo->setCurrentItem(i);
number = key != "advanceto";
if (prevNumber == number && !init)
goto Skipped;
if (number)
{
delete estate;
estate = 0;
value = new TQSpinBox(0, 2000, (key == "advance" || key == "goback")? 1 : 5, this);
hlayout->addWidget(value);
connect(value, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(valueChanged(int)));
value->show();
}
else
{
delete value;
value = 0;
estate = new KComboBox(this);
ConfigEstate *curestate = 0;
TQStringList estateStrings;
for (curestate = estates->first(); curestate; curestate = estates->next())
estateStrings.append(curestate->name());
estate->insertStringList(estateStrings);
connect(estate, TQ_SIGNAL(activated(int)), this, TQ_SLOT(estateChanged(int)));
hlayout->addWidget(estate);
estate->show();
}
prevNumber = number;
Skipped:
init = false;
if (!number)
return;
bool boolean = (key == "outofjail" || key == "tojail" || key == "nextrr" || key == "nextutil");
if (boolean)
{
value->setValue(1);
valueChanged(1);
}
value->setEnabled(!boolean);
TQString suffix = "";
TQString prefix = "";
// first four types are money, pay, payeach, collect, collecteach
if (i < 4 || key == "payhouse" || key == "payhotel")
suffix = "$";
else if (key == "advance" || key == "goback")
suffix = i18n("Estate(s)").prepend(" ");
value->setPrefix(prefix);
value->setSuffix(suffix);
}
/////////////////////////////////
CardView::CardView(EstateList *estates, CardStack *stack, TQWidget *parent, char *name) : TQWidget(parent, name)
{
card = 0;
this->stack = stack;
this->estates = estates;
choosies.setAutoDelete(true);
layout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint());
TQHBoxLayout *hlayout = new TQHBoxLayout(layout, KDialog::spacingHint());
addButton = new KPushButton(i18n("&Add Card..."), this);
connect(addButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(add()));
hlayout->addWidget(addButton);
hlayout->addStretch();
renameButton = new KPushButton(i18n("&Rename..."), this);
connect(renameButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(rename()));
hlayout->addWidget(renameButton);
hlayout->addStretch();
delButton = new KPushButton(i18n("&Delete"), this);
connect(delButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(del()));
hlayout->addWidget(delButton);
List = new TDEListBox(this);
layout->addWidget(List);
connect(List, TQ_SIGNAL(highlighted(int)), this, TQ_SLOT(selected(int)));
// it gets very big (and won't shrink) otherwise
List->setMaximumHeight(90);
hlayout = new TQHBoxLayout(layout, KDialog::spacingHint());
moreButton = new KPushButton(i18n("&More Properties"), this);
connect(moreButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(more()));
hlayout->addWidget(moreButton);
hlayout->addStretch();
lessButton = new KPushButton(i18n("&Fewer Properties"), this);
connect(lessButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(less()));
hlayout->addWidget(lessButton);
for (CardStack::Iterator it = stack->begin(); it != stack->end(); ++it)
List->insertItem((*it).name);
updateButtonsEnabled();
}
void CardView::more()
{
if (!card)
return;
card->keys.append("pay");
card->values.append(0);
ChooseWidget *newChooseWidget = new ChooseWidget(estates, choosies.count(), card, this);
newChooseWidget->typeChanged(0);
newChooseWidget->valueChanged(0);
choosies.append(newChooseWidget);
layout->addWidget(newChooseWidget);
newChooseWidget->show();
updateButtonsEnabled();
}
void CardView::less()
{
if (List->count() <= 0 || choosies.count() <= 0)
return;
choosies.removeLast();
card->keys.pop_back();
card->values.pop_back();
updateButtonsEnabled();
}
void CardView::add()
{
bool ok = false;
TQString name = KLineEditDlg::getText(i18n("Add Card"), i18n("Enter the name of the new card:"), TQString(), &ok, this);
if (ok)
List->insertItem(name, 0);
choosies.clear();
stack->prepend(Card(name));
List->setCurrentItem(0);
more();
updateButtonsEnabled();
}
void CardView::rename()
{
int curItem = List->currentItem();
if (curItem < 0)
return;
bool ok = false;;
TQString name = KLineEditDlg::getText(i18n("Add Card"), i18n("Enter the name of the new card:"), (*stack->at(curItem)).name, &ok, this);
if (ok)
{
(*stack->at(curItem)).name = name;
List->changeItem(name, curItem);
}
updateButtonsEnabled();
}
void CardView::del()
{
int curItem = List->currentItem();
// for some reason, crashes if count == 0
if (curItem < 0 || List->count() <= 1)
return;
List->removeItem(curItem);
stack->remove(stack->at(curItem));
choosies.clear();
updateButtonsEnabled();
}
void CardView::selected(int i)
{
choosies.clear();
card = &(*stack->at(i));
unsigned int num = card->keys.count();
TQValueList<int>::Iterator vit = card->values.begin();
for (TQStringList::Iterator it = card->keys.begin(); it != card->keys.end(); ++it)
{
ChooseWidget *newChooseWidget = new ChooseWidget(estates, choosies.count(), card, this);
choosies.append(newChooseWidget);
layout->addWidget(newChooseWidget);
newChooseWidget->show();
newChooseWidget->typeChanged(types.findIndex(*it));
newChooseWidget->valueChanged(*vit);
newChooseWidget->estateChanged(*vit);
++vit;
}
if (num == 0)
{
card->values.clear();
more();
}
updateButtonsEnabled();
}
void CardView::updateButtonsEnabled()
{
int curItem = List->currentItem();
int count = List->count();
delButton->setEnabled(!(curItem < 0 || count <= 1));
renameButton->setEnabled(!(curItem < 0));
moreButton->setEnabled(card);
lessButton->setEnabled(!(count <= 0 || choosies.count() <= 0));
}
/////////////////////////////////
StreetDlg::StreetDlg(ConfigEstateGroupList *newGroups, TQWidget *parent, char *name)
: EstateDlg(parent, name)
{
groups = newGroups;
TQVBoxLayout *bigbox = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint());
TQVGroupBox *RentPage = new TQVGroupBox(i18n("&Rent by Number of Houses"), this);
RentPage->setInsideSpacing(KDialog::spacingHint());
RentPage->setInsideMargin(KDialog::marginHint());
bigbox->addWidget(RentPage);
TQWidget *topRent = new TQWidget(RentPage);
TQGridLayout *rentBox = new TQGridLayout(topRent, 3, 3, KDialog::spacingHint());
rentBox->addWidget(new TQLabel(i18n("None:"), topRent), 0, 0);
rentBox->addWidget(new TQLabel(i18n("One:"), topRent), 0, 1);
rentBox->addWidget(new TQLabel(i18n("Two:"), topRent), 0, 2);
rentBox->addWidget(new TQLabel(i18n("Three:"), topRent), 2, 0);
rentBox->addWidget(new TQLabel(i18n("Four:"), topRent), 2, 1);
rentBox->addWidget(new TQLabel(i18n("Hotel:"), topRent), 2, 2);
rentBox->addWidget(houses0 = new TQSpinBox(0, 3000, 1, topRent), 1, 0);
rentBox->addWidget(houses1 = new TQSpinBox(0, 3000, 1, topRent), 1, 1);
rentBox->addWidget(houses2 = new TQSpinBox(0, 3000, 1, topRent), 1, 2);
rentBox->addWidget(houses3 = new TQSpinBox(0, 3000, 1, topRent), 3, 0);
rentBox->addWidget(houses4 = new TQSpinBox(0, 3000, 1, topRent), 3, 1);
rentBox->addWidget(houses5 = new TQSpinBox(0, 3000, 1, topRent), 3, 2);
houses0->setSuffix(i18n("$"));
houses0->setSpecialValueText(i18n("None"));
houses1->setSuffix(i18n("$"));
houses1->setSpecialValueText(i18n("None"));
houses2->setSuffix(i18n("$"));
houses2->setSpecialValueText(i18n("None"));
houses3->setSuffix(i18n("$"));
houses3->setSpecialValueText(i18n("None"));
houses4->setSuffix(i18n("$"));
houses4->setSpecialValueText(i18n("None"));
houses5->setSuffix(i18n("$"));
houses5->setSpecialValueText(i18n("None"));
TQGridLayout *pricesBox = new TQGridLayout(bigbox, 2, 2, KDialog::spacingHint());
pricesBox->addWidget(new TQLabel(i18n("Price:"), this), 0, 0);
pricesBox->addWidget(price = new TQSpinBox(0, 3000, 25, this), 0, 1);
price->setSpecialValueText(i18n("None"));
price->setSuffix(i18n("$"));
TQLabel *groupLabel = new TQLabel(i18n("Group:"), this);
pricesBox->addWidget(groupLabel, 1, 0);
groupCombo = new KComboBox(this, "Group Combo");
groupUpdate();
connect(groupCombo, TQ_SIGNAL(activated(const TQString &)), this, TQ_SLOT(groupChanged(const TQString &)));
pricesBox->addWidget(groupCombo, 1, 1);
}
void StreetDlg::groupChanged(const TQString &groupName)
{
for (ConfigEstateGroupList::Iterator it = groups->begin(); it != groups->end(); ++it)
{
if ((*it).name() == groupName)
{
if ( (*it).fgColor().isValid() )
estate->setColor((*it).fgColor());
if ( (*it).bgColor().isValid() )
estate->setBgColor((*it).bgColor());
estate->update();
break;
}
}
}
void StreetDlg::groupUpdate()
{
TQString curGroupName = groupCombo->currentText();
TQStringList newGroups;
for (ConfigEstateGroupList::Iterator it = groups->begin(); it != groups->end(); ++it)
newGroups.append((*it).name());
groupCombo->clear();
groupCombo->insertStringList(newGroups);
if (!curGroupName.isNull())
{
groupCombo->setCurrentText(curGroupName);
groupChanged(curGroupName);
}
}
void StreetDlg::save()
{
estate->setRent(0, houses0->value());
estate->setRent(1, houses1->value());
estate->setRent(2, houses2->value());
estate->setRent(3, houses3->value());
estate->setRent(4, houses4->value());
estate->setRent(5, houses5->value());
estate->setPrice(price->value());
estate->setGroup(groupCombo->currentText());
}
void StreetDlg::update()
{
houses0->setValue(estate->rent(0));
houses1->setValue(estate->rent(1));
houses2->setValue(estate->rent(2));
houses3->setValue(estate->rent(3));
houses4->setValue(estate->rent(4));
houses5->setValue(estate->rent(5));
price->setValue(estate->price());
if (estate->group().isEmpty())
{
groupCombo->setCurrentText("Default");
estate->setGroup("Default");
}
else
groupCombo->setCurrentText(estate->group());
groupChanged(estate->group());
}
#include "editor.moc"