[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.92,1.93 board.h,1.57,1.58 estatedeta
From:       kde () office ! kde ! org
Date:       2002-07-24 3:10:15
[Download RAW message or body]

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

Modified Files:
	board.cpp board.h estatedetails.cpp estatedetails.h 
Log Message:
display flow fixes

Index: board.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/board.cpp,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- board.cpp	2002/07/23 23:39:41	1.92
+++ board.cpp	2002/07/24 03:10:12	1.93
@@ -40,7 +40,7 @@
 	m_maxEstates = maxEstates;
 	m_mode = mode;
 	m_animateTokens = false;
-	m_removeFirstOnPrepend = false;
+	m_lastServerDisplay = 0;
 
 	int sideLen = maxEstates/4;
 
@@ -202,6 +202,7 @@
 void AtlantikBoard::addAuctionWidget(Auction *auction)
 {
 	AuctionWidget *auctionW = new AuctionWidget(m_atlanticCore, auction, this);
+	m_lastServerDisplay = auctionW;
 	m_displayQueue.prepend(auctionW);
 	updateCenter();
 
@@ -403,10 +404,14 @@
 		m_displayQueue.prepend(new QWidget(this));
 		break;
 	case 1:
+		if (m_displayQueue.getFirst() == m_lastServerDisplay)
+			m_lastServerDisplay = 0;
 		m_displayQueue.removeFirst();
 		m_displayQueue.prepend(new QWidget(this));
 		break;
 	default:
+		if (m_displayQueue.getFirst() == m_lastServerDisplay)
+			m_lastServerDisplay = 0;
 		m_displayQueue.removeFirst();
 		break;
 	}
@@ -416,10 +421,11 @@
 void AtlantikBoard::displayText(QString caption, QString body)
 {
 	BoardDisplay *bDisplay = new BoardDisplay(caption, body, this);
+	m_lastServerDisplay = bDisplay;
 
-	if (m_removeFirstOnPrepend)
+	if (m_displayQueue.getFirst() != m_lastServerDisplay)
 		m_displayQueue.removeFirst();
-	m_removeFirstOnPrepend = false;
+
 	m_displayQueue.prepend(bDisplay);
 	updateCenter();
 
@@ -429,18 +435,20 @@
 
 void AtlantikBoard::displayButton(QString command, QString caption, bool enabled)
 {
-	if (BoardDisplay *display = dynamic_cast<BoardDisplay*>(m_displayQueue.getFirst()))
+	if (BoardDisplay *display = dynamic_cast<BoardDisplay*>(m_lastServerDisplay))
 		display->addButton(command, caption, enabled);
-	else if (EstateDetails *display = \
dynamic_cast<EstateDetails*>(m_displayQueue.getFirst())) +	else if (EstateDetails \
*display = dynamic_cast<EstateDetails*>(m_lastServerDisplay))  \
display->addButton(command, caption, enabled);  }
 
 void AtlantikBoard::addCloseButton()
 {
-	if (BoardDisplay *display = dynamic_cast<BoardDisplay*>(m_displayQueue.getFirst()))
-		display->addCloseButton();
-	else if (EstateDetails *display = \
                dynamic_cast<EstateDetails*>(m_displayQueue.getFirst()))
-		display->addCloseButton();
+	BoardDisplay *bDisplay = 0;
+	EstateDetails *eDetails = 0;
+	if ((bDisplay = dynamic_cast<BoardDisplay*>(m_lastServerDisplay)) && bDisplay != \
m_displayQueue.getLast()) +		bDisplay->addCloseButton();
+	else if ((eDetails = dynamic_cast<EstateDetails*>(m_lastServerDisplay)) && eDetails \
!= m_displayQueue.getLast()) +		eDetails->addCloseButton();
 }
 
 void AtlantikBoard::insertEstateDetails(Estate *estate)
@@ -448,11 +456,27 @@
 	if (!estate)
 		return;
 
-	if (m_removeFirstOnPrepend)
+	EstateDetails *eDetails = 0;
+
+	// This might just be a update
+	if ((eDetails = dynamic_cast<EstateDetails*>(m_lastServerDisplay)) && \
eDetails->estate() == estate) +	{
+		eDetails->newUpdate();
+		return;
+	}
+
+	if (m_displayQueue.getFirst() != m_lastServerDisplay)
 		m_displayQueue.removeFirst();
-	m_removeFirstOnPrepend = false;
+	else
+	{
+		if (BoardDisplay *display = dynamic_cast<BoardDisplay*>(m_lastServerDisplay))
+			display->addCloseButton();
+		else if (EstateDetails *display = \
dynamic_cast<EstateDetails*>(m_lastServerDisplay)) +			display->addCloseButton();
+	}
 
-	EstateDetails *eDetails = new EstateDetails(estate, this);
+	eDetails = new EstateDetails(estate, this);
+	m_lastServerDisplay = eDetails;
 	connect(eDetails, SIGNAL(buttonCommand(QString)), this, \
SIGNAL(buttonCommand(QString)));  connect(eDetails, SIGNAL(buttonClose()), this, \
SLOT(displayDefault()));  
@@ -477,9 +501,9 @@
 	EstateDetails *eDetails = new EstateDetails(estate, this);
 	eDetails->addCloseButton();
 
-	if (m_removeFirstOnPrepend)
+	if (m_displayQueue.getFirst() != m_lastServerDisplay)
 		m_displayQueue.removeFirst();
-	m_removeFirstOnPrepend = true;
+
 	m_displayQueue.prepend(eDetails);
 	updateCenter();
 

Index: board.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/board.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- board.h	2002/07/23 23:39:41	1.57
+++ board.h	2002/07/24 03:10:12	1.58
@@ -75,7 +75,7 @@
 	AtlanticCore *m_atlanticCore;
 	DisplayMode m_mode;
 
-	QWidget *spacer;
+	QWidget *spacer, *m_lastServerDisplay;
 	QGridLayout *m_gridLayout;
 	Token *move_token;
 	QTimer *m_timer;
@@ -87,7 +87,6 @@
 	QPtrList<EstateView> m_estateViews;
 	QMap<Player *, Token *> tokenMap;
 	QPtrList<QWidget> m_displayQueue;
-	bool m_removeFirstOnPrepend;
 };
 
 #endif

Index: estatedetails.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/estatedetails.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- estatedetails.cpp	2002/07/23 23:39:41	1.7
+++ estatedetails.cpp	2002/07/24 03:10:12	1.8
@@ -40,6 +40,7 @@
 	b_recreate = true;
 
 	m_quartzBlocks = 0;	
+	m_closeButton = 0;
 	m_recreateQuartz = true;
 
 	m_mainLayout = new QVBoxLayout(this, KDialog::marginHint(), \
KDialog::spacingHint()); @@ -209,13 +210,29 @@
 
 	connect(button, SIGNAL(pressed()), this, SLOT(buttonPressed()));
 }
+
 void EstateDetails::addCloseButton()
 {
-	KPushButton *button = new KPushButton("Close", this);
-	m_buttonBox->addWidget(button);
-	button->show();
+	m_closeButton = new KPushButton("Close", this);
+	m_buttonBox->addWidget(m_closeButton);
+	m_closeButton->show();
 
-	connect(button, SIGNAL(pressed()), this, SIGNAL(buttonClose()));
+	connect(m_closeButton, SIGNAL(pressed()), this, SIGNAL(buttonClose()));
+}
+
+void EstateDetails::newUpdate()
+{
+	if (m_closeButton)
+	{
+		delete m_closeButton;
+		m_closeButton = 0;
+	}
+
+	// Delete buttons
+	
+	// Redraw details
+	b_recreate = true;
+	update();
 }
 
 void EstateDetails::buttonPressed()

Index: estatedetails.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/estatedetails.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- estatedetails.h	2002/07/23 23:39:41	1.5
+++ estatedetails.h	2002/07/24 03:10:13	1.6
@@ -25,6 +25,7 @@
 class QVGroupBox;
 
 class KPixmap;
+class KPushButton;
 
 class Player;
 class Estate;
@@ -39,6 +40,7 @@
 
 	void addButton(const QString command, const QString caption, bool enabled);
 	void addCloseButton();
+	void newUpdate();
 
 protected:
 	void paintEvent(QPaintEvent *);
@@ -55,6 +57,7 @@
 	Estate *m_estate;
 	QPixmap *m_pixmap;
 	KPixmap *m_quartzBlocks;
+	KPushButton *m_closeButton;
 	bool b_recreate, m_recreateQuartz;
 	QVBoxLayout *m_mainLayout;
 	QHBoxLayout *m_buttonBox;

_______________________________________________
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