[prev in list] [next in list] [prev in thread] [next in thread] 

List:       atlantik-devel
Subject:    [atlantik-cvs] CVS: kdegames/atlantik/libatlantikui board.cpp,1.96,1.97 board.h,1.59,1.60 estatedeta
From:       kde () office ! kde ! org
Date:       2002-11-27 21:08:59
[Download RAW message or body]

Update of /home/kde/kdegames/atlantik/libatlantikui
In directory office:/tmp/cvs-serv6542/libatlantikui

Modified Files:
	board.cpp board.h estatedetails.cpp estatedetails.h 
	portfolioview.cpp portfolioview.h 
Log Message:
qmap->qptrlist changes, improved estatedetails widget

Index: board.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/board.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- board.cpp	2002/10/05 04:37:40	1.96
+++ board.cpp	2002/11/27 21:08:56	1.97
@@ -151,7 +151,7 @@
 void AtlantikBoard::addEstateView(Estate *estate, bool indicateUnowned, bool \
highliteUnowned, bool darkenMortgaged, bool quartzEffects)  {
 	QString icon = QString();
-	int estateId = estate->estateId();
+	int estateId = estate->id();
 	EstateOrientation orientation = North;
 	int sideLen = m_gridLayout->numRows() - 1;
 
@@ -420,21 +420,6 @@
 	updateCenter();
 }
 
-void AtlantikBoard::displayText(QString caption, QString body)
-{
-	BoardDisplay *bDisplay = new BoardDisplay(caption, body, this);
-	m_lastServerDisplay = bDisplay;
-
-	if (m_displayQueue.getFirst() != m_lastServerDisplay)
-		m_displayQueue.removeFirst();
-
-	m_displayQueue.prepend(bDisplay);
-	updateCenter();
-
-	connect(bDisplay, SIGNAL(buttonCommand(QString)), this, \
                SIGNAL(buttonCommand(QString)));
-	connect(bDisplay, SIGNAL(buttonClose()), this, SLOT(displayDefault()));
-}
-
 void AtlantikBoard::displayButton(QString command, QString caption, bool enabled)
 {
 	if (BoardDisplay *display = dynamic_cast<BoardDisplay*>(m_lastServerDisplay))
@@ -453,17 +438,20 @@
 		eDetails->addCloseButton();
 }
 
-void AtlantikBoard::insertEstateDetails(Estate *estate)
+void AtlantikBoard::insertDetails(QString text, Estate *estate)
 {
 	if (!estate)
+	{
+		kdDebug() << "insertDetails called with empty estate" << endl;
 		return;
+	}
 
 	EstateDetails *eDetails = 0;
 
 	// This might just be a update
 	if ((eDetails = dynamic_cast<EstateDetails*>(m_lastServerDisplay)) && \
eDetails->estate() == estate)  {
-		eDetails->newUpdate();
+		eDetails->newUpdate(text);
 		return;
 	}
 
@@ -477,7 +465,7 @@
 			display->addCloseButton();
 	}
 
-	eDetails = new EstateDetails(estate, this);
+	eDetails = new EstateDetails(text, estate, this);
 	m_lastServerDisplay = eDetails;
 	connect(eDetails, SIGNAL(buttonCommand(QString)), this, \
SIGNAL(buttonCommand(QString)));  connect(eDetails, SIGNAL(buttonClose()), this, \
SLOT(displayDefault())); @@ -500,7 +488,7 @@
 	if (!estate)
 		return;
 
-	EstateDetails *eDetails = new EstateDetails(estate, this);
+	EstateDetails *eDetails = new EstateDetails(QString(), estate, this);
 	eDetails->addCloseButton();
 
 	if (m_displayQueue.getFirst() != m_lastServerDisplay)

Index: board.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/board.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- board.h	2002/07/25 14:38:36	1.59
+++ board.h	2002/11/27 21:08:56	1.60
@@ -55,10 +55,9 @@
 private slots:
 	void playerChanged();
 	void displayDefault();
-	void displayText(QString caption, QString body);
 	void displayButton(QString command, QString caption, bool enabled);
 	void prependEstateDetails(Estate *);
-	void insertEstateDetails(Estate *);
+	void insertDetails(QString text, Estate *estate = 0);
 	void addCloseButton();
 
 signals:

Index: estatedetails.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/estatedetails.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- estatedetails.cpp	2002/10/23 19:18:20	1.12
+++ estatedetails.cpp	2002/11/27 21:08:56	1.13
@@ -22,6 +22,8 @@
 
 #include <kdialog.h>
 #include <kglobalsettings.h>
+#include <kiconloader.h>
+#include <klistview.h>
 #include <klocale.h>
 #include <kpixmap.h>
 #include <kpushbutton.h>
@@ -33,7 +35,7 @@
 #include "estatedetails.h"
 #include "estatedetails.moc"
 
-EstateDetails::EstateDetails(Estate *estate, QWidget *parent, const char *name) : \
QWidget(parent, name) +EstateDetails::EstateDetails(QString text, Estate *estate, \
QWidget *parent, const char *name) : QWidget(parent, name)  {
 	m_estate = estate;
 	setPaletteBackgroundColor(m_estate->bgColor());
@@ -49,14 +51,52 @@
 	m_mainLayout = new QVBoxLayout(this, KDialog::marginHint(), \
KDialog::spacingHint());  Q_CHECK_PTR(m_mainLayout);
 
-	m_mainLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, \
QSizePolicy::Expanding)); +	m_mainLayout->addItem(new \
QSpacerItem(KDialog::spacingHint(), KDialog::spacingHint()+50, QSizePolicy::Fixed, \
QSizePolicy::Minimum)); +
+	m_infoListView = new KListView(this, "infoListView");
+    m_infoListView->addColumn(m_estate ? m_estate->name() : "");
+    m_infoListView->setSorting(1);
+	m_mainLayout->addWidget(m_infoListView);
+
+	// Info text
+	QListViewItem *infoText = 0;
+	if (!text.isEmpty())
+	{
+		infoText = new QListViewItem(m_infoListView, text, m_infoListView.childCount());
+		infoText->setPixmap(0, QPixmap(SmallIcon("atlantik")));
+	}
+
+	// Price
+	if (m_estate->price())
+	{
+		infoText = new QListViewItem(m_infoListView, i18n("Price: \
%1").arg(m_estate->price()), m_infoListView.childCount()); +		infoText->setPixmap(0, \
QPixmap(SmallIcon("info"))); +	}
+
+	// Owner, houses, isMortgaged
+	if (m_estate->canBeOwned())
+	{
+		infoText = new QListViewItem(m_infoListView, i18n("Owner: \
%1").arg(m_estate->owner() ? m_estate->owner()->name() : i18n("unowned"))); \
+		infoText->setPixmap(0, QPixmap(SmallIcon("info"))); +
+		if (m_estate->isOwned())
+		{
+			infoText = new QListViewItem(m_infoListView, i18n("Houses: \
%1").arg(m_estate->houses()), m_infoListView.childCount()); \
+			infoText->setPixmap(0, QPixmap(SmallIcon("info")));  
+			infoText = new QListViewItem(m_infoListView, i18n("Mortgaged: \
%1").arg(m_estate->isMortgaged() ? i18n("Yes") : i18n("No")), \
m_infoListView.childCount()); +			infoText->setPixmap(0, QPixmap(SmallIcon("info")));
+		}
+	}
+
 	m_buttonBox = new QHBoxLayout(this, 0, KDialog::spacingHint());
 	m_mainLayout->addItem(m_buttonBox);
 
 	m_buttonBox->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, \
QSizePolicy::Minimum));  }
 
+// TODO: destructor cleaning up all buttons and listviewitems
+
 void EstateDetails::paintEvent(QPaintEvent *)
 {
 	if (m_recreateQuartz)
@@ -161,6 +201,7 @@
 		painter.setPen(Qt::black);
 
 		int xText = 0;
+
 		// Estate group
 		if (m_estate->estateGroup())
 		{
@@ -172,29 +213,6 @@
 		xText = titleHeight + fontSize + 5;
 		painter.setFont(QFont(KGlobalSettings::generalFont().family(), fontSize, \
QFont::Normal));  
-		// Price
-		if (m_estate->price())
-		{
-			painter.drawText(5, xText, i18n("Price: %1").arg(m_estate->price()));
-			xText += (fontSize + 5);
-		}
-
-		// Owner, houses, isMortgaged
-		if (m_estate->canBeOwned())
-		{
-			painter.drawText(5, xText, i18n("Owner: %1").arg(m_estate->owner() ? \
                m_estate->owner()->name() : i18n("unowned")));
-			xText += (fontSize + 5);
-
-			if (m_estate->isOwned())
-			{
-				painter.drawText(5, xText, i18n("Houses: %1").arg(m_estate->houses()));
-				xText += (fontSize + 5);
-
-				painter.drawText(5, xText, i18n("Mortgaged: %1").arg(m_estate->isMortgaged() ? \
                i18n("Yes") : i18n("No")));
-				xText += (fontSize + 5);
-			}
-		}
-
 		b_recreate = false;
 	}
 	bitBlt(this, 0, 0, m_pixmap);
@@ -228,7 +246,7 @@
 	connect(m_closeButton, SIGNAL(pressed()), this, SIGNAL(buttonClose()));
 }
 
-void EstateDetails::newUpdate()
+void EstateDetails::newUpdate(QString text)
 {
 	if (m_closeButton)
 	{
@@ -239,6 +257,10 @@
 	// Delete buttons
 	m_buttons.clear();
 	m_buttonCommandMap.clear();
+
+	// Append text
+	QListViewItem *infoText = new QListViewItem(m_infoListView, text, \
m_infoListView.childCount()); +	infoText->setPixmap(0, \
QPixmap(SmallIcon("atlantik")));  
 	// Redraw details
 	b_recreate = true;

Index: estatedetails.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/estatedetails.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- estatedetails.h	2002/07/24 03:35:39	1.7
+++ estatedetails.h	2002/11/27 21:08:56	1.8
@@ -20,10 +20,12 @@
 #include <qwidget.h>
 
 class QPixmap;
+class QString;
 class QHBoxLayout;
 class QVBoxLayout;
 class QVGroupBox;
 
+class KListView;
 class KPixmap;
 class KPushButton;
 
@@ -35,12 +37,12 @@
 Q_OBJECT
 
 public:
-	EstateDetails(Estate *estate, QWidget *parent, const char *name = 0);
+	EstateDetails(QString text, Estate *estate, QWidget *parent, const char *name = 0);
 	Estate *estate() { return m_estate; }
 
 	void addButton(const QString command, const QString caption, bool enabled);
 	void addCloseButton();
-	void newUpdate();
+	void newUpdate(QString text);
 
 protected:
 	void paintEvent(QPaintEvent *);
@@ -57,6 +59,7 @@
 	Estate *m_estate;
 	QPixmap *m_pixmap;
 	KPixmap *m_quartzBlocks;
+	KListView *m_infoListView;
 	KPushButton *m_closeButton;
 	bool b_recreate, m_recreateQuartz;
 	QVBoxLayout *m_mainLayout;

Index: portfolioview.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/portfolioview.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- portfolioview.cpp	2002/07/07 18:31:38	1.46
+++ portfolioview.cpp	2002/11/27 21:08:56	1.47
@@ -65,10 +65,6 @@
 	m_moneyLabel->setMaximumWidth(width()/2);
 	m_moneyLabel->setMaximumHeight(15);
 	m_moneyLabel->show();
-	
-	m_lastGroup = "";
-	x = 0;
-	y = 0;
 
 	// TODO: call buildPortfolio? Although, we should be able to assume no
 	// new estates or players are introduced after the game has been started
@@ -103,7 +99,7 @@
 				{
 					// Create PE
 					PortfolioEstate *portfolioEstate = new PortfolioEstate(estate, m_player, false, \
                this, "portfolioestate");
-					portfolioEstateMap[estate->estateId()] = portfolioEstate;
+					portfolioEstateMap[estate->id()] = portfolioEstate;
 
  					connect(portfolioEstate, SIGNAL(estateClicked(Estate *)), this, \
SIGNAL(estateClicked(Estate *)));  int x, y;

Index: portfolioview.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/portfolioview.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- portfolioview.h	2002/07/07 18:31:38	1.23
+++ portfolioview.h	2002/11/27 21:08:56	1.24
@@ -62,8 +62,6 @@
 	bool b_recreate;
 	QLabel *m_nameLabel, *m_moneyLabel;
 	QMap<int, PortfolioEstate*> portfolioEstateMap;
-	int x, y;
-	QString m_lastGroup;
 };
 
 #endif

_______________________________________________
atlantik-cvs mailing list
atlantik-cvs@mail.kde.org
http://mail.kde.org/mailman/listinfo/atlantik-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic