[prev in list] [next in list] [prev in thread] [next in thread]
List: atlantik-devel
Subject: [atlantik-devel] CVS: kdeaddons/atlantikdesigner/designer boardinfo.cpp,1.3,1.4 boardinfo.h,1.2,1.3
From: kde () office ! kde ! org
Date: 2002-06-12 1:31:37
[Download RAW message or body]
Update of /home/kde/kdeaddons/atlantikdesigner/designer
In directory office:/tmp/cvs-serv19417/designer
Modified Files:
boardinfo.cpp boardinfo.h designer.cpp designer.h editor.cpp
group.cpp group.h
Log Message:
add global prices, change spinboxes so they show 'None' when at 0
Index: boardinfo.cpp
===================================================================
RCS file: /home/kde/kdeaddons/atlantikdesigner/designer/boardinfo.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- boardinfo.cpp 2002/06/10 04:08:05 1.3
+++ boardinfo.cpp 2002/06/12 01:31:34 1.4
@@ -15,13 +15,15 @@
#include "boardinfo.h"
-BoardInfoDlg::BoardInfoDlg(bool editable, BoardInfo *info, QWidget *parent, char \
*_name, bool modal) +BoardInfoDlg::BoardInfoDlg(bool editable, BoardInfo *info, \
QWidget *parent, const char *_name, bool modal) : KDialogBase(KDialogBase::Tabbed, \
i18n("Gameboard Information"), (editable? Ok|Apply|Cancel : Close), (editable? Ok : \
Close), parent, _name, modal) {
if (!info)
return;
this->info = info;
+ setWFlags(WDestructiveClose);
+
QFrame *about = addPage(i18n("About"));
QVBoxLayout *aboutLayout = new QVBoxLayout(about, spacingHint());
@@ -108,7 +110,7 @@
///////////////////////////////////
-LotsaEdits::LotsaEdits(bool editable, QStringList defaults, QWidget *parent, char \
*name) : QWidget(parent, name) +LotsaEdits::LotsaEdits(bool editable, QStringList \
defaults, QWidget *parent, const char *name) : QWidget(parent, name) {
list.setAutoDelete(true);
this->editable = editable;
Index: boardinfo.h
===================================================================
RCS file: /home/kde/kdeaddons/atlantikdesigner/designer/boardinfo.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- boardinfo.h 2002/06/10 04:08:05 1.2
+++ boardinfo.h 2002/06/12 01:31:34 1.3
@@ -32,7 +32,7 @@
Q_OBJECT
public:
- LotsaEdits(bool, QStringList=QStringList(), QWidget *parent=0, char *name=0);
+ LotsaEdits(bool, QStringList=QStringList(), QWidget *parent=0, const char *name=0);
public slots:
QStringList save();
@@ -52,7 +52,7 @@
Q_OBJECT
public:
- BoardInfoDlg(bool editable, BoardInfo *, QWidget *parent=0, char *_name=0, bool = \
true); + BoardInfoDlg(bool editable, BoardInfo *, QWidget *parent=0, const char \
*_name=0, bool = true);
protected slots:
void slotOk();
Index: designer.cpp
===================================================================
RCS file: /home/kde/kdeaddons/atlantikdesigner/designer/designer.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- designer.cpp 2002/06/11 03:29:55 1.40
+++ designer.cpp 2002/06/12 01:31:34 1.41
@@ -475,6 +475,19 @@
}
else if (parseMode == Parse_EstateGroups)
{
+ bool found = false;
+ for (ConfigEstateGroupList::Iterator it = groups.begin(); it != groups.end(); \
++it) + {
+ if ((*it).name() == name)
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ continue;
+
ConfigEstateGroup group(name);
group.setHousePrice(housePrice);
group.setGlobalPrice(globalPrice);
@@ -652,8 +665,14 @@
t << "<EstateGroups>" << endl;
+ // double-prevent duplicates
+ QStringList writtenGroups;
+
for (ConfigEstateGroupList::Iterator it = groups.begin(); it != groups.end(); \
++it) {
+ if (writtenGroups.contains((*it).name()) > 0)
+ continue;
+
if ((*it).name() == i18n("Default"))
{
bool containsDefault = false;
@@ -670,6 +689,8 @@
continue;
}
+ writtenGroups.append((*it).name());
+
t << endl << QString("[%1]").arg((*it).name()) << endl;
if ((*it).housePrice() > 0)
t << "houseprice=" << (*it).housePrice() << endl;
@@ -889,15 +910,15 @@
{
if (groupEditor.isNull())
{
- groupEditor = new GroupEditor(&groups);
+ 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()));
}
else
groupEditor->raise();
-
- connect(groupEditor, SIGNAL(changed()), this, SLOT(modified()));
- connect(groupEditor, SIGNAL(update()), this, SLOT(groupsChanged()));
- connect(groupEditor, SIGNAL(update()), editor, SLOT(groupsChanged()));
}
void AtlanticDesigner::goChanged(int id)
@@ -942,10 +963,17 @@
void AtlanticDesigner::info()
{
- BoardInfoDlg *dlg = new BoardInfoDlg(true, &boardInfo, this);
- connect(dlg, SIGNAL(okClicked()), this, SLOT(updateBackground()));
- connect(dlg, SIGNAL(okClicked()), this, SLOT(modified()));
- dlg->show();
+ if (boardInfoDlg.isNull())
+ {
+ // non-modal
+ 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()));
+ }
+ else
+ boardInfoDlg->raise();
}
// now some fun functions ;)
Index: designer.h
===================================================================
RCS file: /home/kde/kdeaddons/atlantikdesigner/designer/designer.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- designer.h 2002/06/11 03:29:55 1.16
+++ designer.h 2002/06/12 01:31:34 1.17
@@ -76,6 +76,7 @@
QGuardedPtr<QVBoxLayout> layout;
QGuardedPtr<AtlantikBoard> board;
QGuardedPtr<GroupEditor> groupEditor;
+ QGuardedPtr<BoardInfoDlg> boardInfoDlg;
EstateList estates;
KListAction *estateAct;
KRecentFilesAction *recentAct;
Index: editor.cpp
===================================================================
RCS file: /home/kde/kdeaddons/atlantikdesigner/designer/editor.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- editor.cpp 2002/06/11 03:29:55 1.27
+++ editor.cpp 2002/06/12 01:31:34 1.28
@@ -339,9 +339,11 @@
QGridLayout *taxBox = new QGridLayout(this, 2, 2, KDialog::marginHint(), \
KDialog::spacingHint()); taxBox->addWidget(new QLabel(i18n("Fixed tax"), this), 0, \
0); taxBox->addWidget(tax = new QSpinBox(0, 3000, 1, this), 0, 1);
+ tax->setSpecialValueText(i18n("None"));
tax->setSuffix("$");
taxBox->addWidget(new QLabel(i18n("Percentage tax"), this), 1, 0);
taxBox->addWidget(taxPercentage = new QSpinBox(0, 100, 1, this), 1, 1);
+ taxPercentage->setSpecialValueText(i18n("None"));
taxPercentage->setSuffix("%");
}
@@ -766,15 +768,22 @@
rentBox->addWidget(houses4 = new QSpinBox(0, 3000, 1, topRent), 3, 1);
rentBox->addWidget(houses5 = new QSpinBox(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"));
QGridLayout *pricesBox = new QGridLayout(bigbox, 2, 2, KDialog::spacingHint());
pricesBox->addWidget(new QLabel(i18n("Price"), this), 0, 0);
pricesBox->addWidget(price = new QSpinBox(0, 3000, 25, this), 0, 1);
+ price->setSpecialValueText(i18n("None"));
price->setSuffix(i18n("$"));
QLabel *groupLabel = new QLabel(i18n("Group"), this);
Index: group.cpp
===================================================================
RCS file: /home/kde/kdeaddons/atlantikdesigner/designer/group.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- group.cpp 2002/06/11 01:39:43 1.4
+++ group.cpp 2002/06/12 01:31:34 1.5
@@ -19,8 +19,8 @@
#include "group.h"
-GroupEditor::GroupEditor(ConfigEstateGroupList *newList)
- : KDialogBase(KDialogBase::Plain, i18n("Group Editor"), Ok|Apply|Cancel, Ok, 0, \
"Group Editor", false, true), mylist(*newList) \
+GroupEditor::GroupEditor(ConfigEstateGroupList *newList, QWidget *parent) + : \
KDialogBase(KDialogBase::Plain, i18n("Group Editor"), Ok|Apply|Cancel, Ok, parent, \
"Group Editor", false, true), mylist(*newList) {
setWFlags(WDestructiveClose);
list = newList;
@@ -55,13 +55,23 @@
vlayout->addWidget(pricesGroupBox);
pricesWidget = new QWidget(pricesGroupBox);
- QHBoxLayout *housePriceLayout = new QHBoxLayout(pricesWidget, 0, spacingHint());
- housePriceLayout->addWidget(new QLabel(i18n("House price"), pricesWidget), 1, 0);
- housePriceLayout->addWidget(housePrice = new QSpinBox(0, 3000, 25, pricesWidget));
+ QGridLayout *pricesLayout = new QGridLayout(pricesWidget, 2, 2, 0, spacingHint());
+ pricesLayout->addWidget(new QLabel(i18n("House price"), pricesWidget), 0, 0);
+ pricesLayout->addWidget(housePrice = new QSpinBox(0, 3000, 25, pricesWidget), 0, \
1); + housePrice->setSpecialValueText(i18n("None"));
housePrice->setSuffix(i18n("$"));
connect(housePrice, SIGNAL(valueChanged(int)), this, SLOT(housePriceChanged(int)));
- mathWidget = new QWidget(pricesGroupBox);
+ pricesLayout->addWidget(new QLabel(i18n("Global price"), pricesWidget), 1, 0);
+ pricesLayout->addWidget(globalPrice = new QSpinBox(0, 3000, 25, pricesWidget), 1, \
1); + globalPrice->setSpecialValueText(i18n("None"));
+ globalPrice->setSuffix(i18n("$"));
+ connect(globalPrice, SIGNAL(valueChanged(int)), this, \
SLOT(globalPriceChanged(int))); +
+ dynamicGroupBox = new QVGroupBox(i18n("&Dynamic Rent"), page);
+ vlayout->addWidget(dynamicGroupBox);
+
+ mathWidget = new QWidget(dynamicGroupBox);
QGridLayout *mathLayout = new QGridLayout(mathWidget, 2, 2, 0, spacingHint());
mathLayout->addWidget(new QLabel(i18n("Rent variable"), mathWidget), 0, 0);
mathLayout->addWidget(new QLabel(i18n("Expression:"), mathWidget), 1, 0);
@@ -139,6 +149,7 @@
fgButton->setColor((*it).fgColor());
bgButton->setColor((*it).bgColor());
housePrice->setValue((*it).housePrice());
+ globalPrice->setValue((*it).globalPrice());
rentMathEdit->setText((*it).rentMath());
if (!(*it).rentVar().isNull())
rentVarCombo->setCurrentText((*it).rentVar());
@@ -181,6 +192,13 @@
group->setHousePrice(newValue);
}
+void GroupEditor::globalPriceChanged(int newValue)
+{
+ ConfigEstateGroup *group = currentGroup();
+ if (group)
+ group->setGlobalPrice(newValue);
+}
+
void GroupEditor::rentVarChanged(const QString &newValue)
{
ConfigEstateGroup *group = currentGroup();
@@ -196,6 +214,8 @@
group->setRentMath(newValue);
if (group->rentVar().isEmpty())
group->setRentVar(rentVarCombo->currentText());
+ else
+ group->setRentVar(QString::null);
}
}
@@ -220,6 +240,7 @@
bool issel = groups->currentItem() >= 0;
colorGroupBox->setEnabled(issel);
pricesGroupBox->setEnabled(issel);
+ dynamicGroupBox->setEnabled(issel);
removeB->setEnabled(issel);
}
Index: group.h
===================================================================
RCS file: /home/kde/kdeaddons/atlantikdesigner/designer/group.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- group.h 2002/06/10 04:08:05 1.3
+++ group.h 2002/06/12 01:31:34 1.4
@@ -23,7 +23,7 @@
public:
ConfigEstateGroup() { init(); }
ConfigEstateGroup(const QString &name) { setName(name); init(); }
- void init() { setHousePrice(0); }
+ void init() { setHousePrice(0); setGlobalPrice(0); }
void setHousePrice(int newPrice) { m_housePrice = newPrice; }
int housePrice() { return m_housePrice; }
@@ -58,7 +58,7 @@
Q_OBJECT
public:
- GroupEditor(ConfigEstateGroupList *);
+ GroupEditor(ConfigEstateGroupList *, QWidget *parent=0);
signals:
void changed();
@@ -73,6 +73,7 @@
void fgChanged(const QColor &);
void bgChanged(const QColor &);
void housePriceChanged(int);
+ void globalPriceChanged(int);
void rentVarChanged(const QString &);
void rentMathChanged(const QString &);
void add();
@@ -88,8 +89,10 @@
QWidget *pricesWidget;
QWidget *mathWidget;
QSpinBox *housePrice;
+ QSpinBox *globalPrice;
QVGroupBox *colorGroupBox;
QVGroupBox *pricesGroupBox;
+ QVGroupBox *dynamicGroupBox;
KPushButton *removeB;
ConfigEstateGroupList *list;
_______________________________________________
atlantik-devel mailing list
atlantik-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/atlantik-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic