[prev in list] [next in list] [prev in thread] [next in thread]
List: atlantik-devel
Subject: [atlantik-cvs] CVS: kdegames/atlantik/client atlantik.cpp,1.121.6.5,1.121.6.6 atlantik.h,1.51,1.51.6
From: kde () office ! kde ! org
Date: 2003-01-20 23:47:39
[Download RAW message or body]
Update of /home/kde/kdegames/atlantik/client
In directory office:/tmp/cvs-serv19497/client
Modified Files:
Tag: KDE_3_1_BRANCH
atlantik.cpp atlantik.h
Log Message:
backport use of portfolioview in game config
Index: atlantik.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/atlantik.cpp,v
retrieving revision 1.121.6.5
retrieving revision 1.121.6.6
diff -u -d -r1.121.6.5 -r1.121.6.6
--- atlantik.cpp 20 Jan 2003 22:28:06 -0000 1.121.6.5
+++ atlantik.cpp 20 Jan 2003 23:47:36 -0000 1.121.6.6
@@ -69,6 +69,7 @@
m_atlanticCore = new AtlanticCore(this, "atlanticCore");
initNetworkObject();
+ connect(m_atlanticCore, SIGNAL(removeGUI(Player *)), this, SLOT(removeGUI(Player \
*))); connect(m_atlanticCore, SIGNAL(removeGUI(Trade *)), this, SLOT(removeGUI(Trade \
*)));
// Menu,toolbar: Move
@@ -172,26 +173,17 @@
if (m_selectConfiguration)
m_selectConfiguration->addPlayer(player);
- PortfolioView *portfolioView = new PortfolioView(m_atlanticCore, player, \
m_config.activeColor, m_config.inactiveColor, m_portfolioWidget);
- m_portfolioViews.append(portfolioView);
+ addPortfolioView(player);
if (player->isSelf())
- {
m_playerSelf = player;
- connect(player, SIGNAL(changed(Player *)), this, SLOT(playerChanged()));
- }
- connect(player, SIGNAL(changed(Player *)), portfolioView, SLOT(playerChanged()));
- connect(portfolioView, SIGNAL(newTrade(Player *)), m_atlantikNetwork, \
SLOT(newTrade(Player *)));
- connect(portfolioView, SIGNAL(estateClicked(Estate *)), m_board, \
SLOT(prependEstateDetails(Estate *)));
- m_portfolioLayout->addWidget(portfolioView);
- portfolioView->show();
+ connect(player, SIGNAL(changed(Player *)), this, SLOT(playerChanged(Player *)));
}
void Atlantik::newEstate(Estate *estate)
{
initBoard();
-
m_board->addEstateView(estate, m_config.indicateUnowned, m_config.highliteUnowned, \
m_config.darkenMortgaged, m_config.quartzEffects); }
@@ -205,10 +197,22 @@
void Atlantik::newAuction(Auction *auction)
{
initBoard();
-
m_board->addAuctionWidget(auction);
}
+void Atlantik::removeGUI(Player *player)
+{
+ // Find and remove portfolioview
+ PortfolioView *portfolioView = findPortfolioView(player);
+ if (portfolioView)
+ {
+ m_portfolioViews.remove(portfolioView);
+ delete portfolioView;
+ }
+
+ // TODO: Remove tokens from board
+}
+
void Atlantik::removeGUI(Trade *trade)
{
if (TradeDisplay *tradeDisplay = m_tradeGUIMap[trade])
@@ -222,12 +226,14 @@
m_selectServer->show();
if (m_selectGame)
{
+ disconnect(m_atlantikNetwork, SIGNAL(gameListClear()), m_selectGame, \
SLOT(slotGameListClear())); + connect(m_atlantikNetwork, SIGNAL(gameListClear()), \
this, SLOT(showSelectGame())); +
delete m_selectGame;
m_selectGame = 0;
}
initNetworkObject();
- connect(m_atlantikNetwork, SIGNAL(gameListClear()), this, SLOT(showSelectGame())); \
// disconnect from selectGame implied by deletion above connect(m_selectServer, \
SIGNAL(serverConnect(const QString, int)), m_atlantikNetwork, \
SLOT(serverConnect(const QString, int))); }
@@ -263,7 +269,6 @@
}
connect(m_atlantikNetwork, SIGNAL(gameListClear()), m_selectGame, \
SLOT(slotGameListClear()));
-
connect(m_atlantikNetwork, SIGNAL(gameListAdd(QString, QString, QString, QString, \
QString)), m_selectGame, SLOT(slotGameListAdd(QString, QString, QString, QString, \
QString))); connect(m_atlantikNetwork, SIGNAL(gameListEdit(QString, QString, \
QString, QString, QString)), m_selectGame, SLOT(slotGameListEdit(QString, QString, \
QString, QString, QString))); connect(m_atlantikNetwork, \
SIGNAL(gameListDel(QString)), m_selectGame, SLOT(slotGameListDel(QString))); @@ \
-278,6 +283,9 @@ {
if (m_selectGame)
{
+ disconnect(m_atlantikNetwork, SIGNAL(gameListClear()), m_selectGame, \
SLOT(slotGameListClear())); + connect(m_atlantikNetwork, SIGNAL(gameListClear()), \
this, SLOT(showSelectGame())); +
delete m_selectGame;
m_selectGame = 0;
}
@@ -289,7 +297,6 @@
m_mainLayout->addMultiCellWidget(m_selectConfiguration, 0, 2, 1, 1);
m_selectConfiguration->show();
- connect(m_atlantikNetwork, SIGNAL(gameListClear()), this, SLOT(showSelectGame()));
connect(m_atlantikNetwork, SIGNAL(gameOption(QString, QString, QString, QString, \
QString)), m_selectConfiguration, SLOT(gameOption(QString, QString, QString, QString, \
QString))); connect(m_selectConfiguration, SIGNAL(startGame()), m_atlantikNetwork, \
SLOT(startGame())); connect(m_selectConfiguration, SIGNAL(leaveGame()), \
m_atlantikNetwork, SLOT(leaveGame())); @@ -317,6 +324,9 @@
{
if (m_selectGame)
{
+ disconnect(m_atlantikNetwork, SIGNAL(gameListClear()), m_selectGame, \
SLOT(slotGameListClear())); + connect(m_atlantikNetwork, SIGNAL(gameListClear()), \
this, SLOT(showSelectGame())); +
delete m_selectGame;
m_selectGame = 0;
}
@@ -491,17 +501,29 @@
m_serverMsgs->ensureVisible(0, m_serverMsgs->contentsHeight());
}
-void Atlantik::playerChanged()
+void Atlantik::playerChanged(Player *player)
{
- m_roll->setEnabled(m_playerSelf->canRoll());
- m_buyEstate->setEnabled(m_playerSelf->canBuy());
- m_auctionEstate->setEnabled(m_playerSelf->canBuy());
+ PortfolioView *portfolioView = findPortfolioView(player);
+ if (portfolioView && player->gameId() == -1)
+ {
+ m_portfolioViews.remove(portfolioView);
+ delete portfolioView;
+ }
+ else if (!portfolioView && player->gameId() != -1)
+ addPortfolioView(player);
- // TODO: Should be more finetuned, but monopd doesn't send can_endturn \
can_usejailcard can_payjail can_jailroll yet
- m_endTurn->setEnabled(m_playerSelf->hasTurn() && !(m_playerSelf->canRoll() || \
m_playerSelf->canBuy() || m_playerSelf->inJail()));
- m_jailCard->setEnabled(m_playerSelf->hasTurn() && m_playerSelf->inJail());
- m_jailPay->setEnabled(m_playerSelf->hasTurn() && m_playerSelf->inJail());
- m_jailRoll->setEnabled(m_playerSelf->hasTurn() && m_playerSelf->inJail());
+ if (player == m_playerSelf)
+ {
+ m_roll->setEnabled(player->canRoll());
+ m_buyEstate->setEnabled(player->canBuy());
+ m_auctionEstate->setEnabled(player->canBuy());
+
+ // TODO: Should be more finetuned, but monopd doesn't send can_endturn \
can_usejailcard can_payjail can_jailroll yet \
+ m_endTurn->setEnabled(player->hasTurn() && !(player->canRoll() || player->canBuy() \
|| player->inJail())); + m_jailCard->setEnabled(player->hasTurn() && \
player->inJail()); + m_jailPay->setEnabled(player->hasTurn() && player->inJail());
+ m_jailRoll->setEnabled(player->hasTurn() && player->inJail());
+ }
}
void Atlantik::initNetworkObject()
@@ -520,6 +542,7 @@
connect(m_atlantikNetwork, SIGNAL(connectionSuccess()), this, \
SLOT(slotNetworkConnected())); connect(m_atlantikNetwork, \
SIGNAL(connectionFailed(int)), this, SLOT(slotNetworkError(int)));
+ connect(m_atlantikNetwork, SIGNAL(gameListClear()), this, SLOT(showSelectGame()));
connect(m_atlantikNetwork, SIGNAL(gameConfig()), this, \
SLOT(showSelectConfiguration())); connect(m_atlantikNetwork, SIGNAL(gameInit()), \
this, SLOT(initBoard())); connect(m_atlantikNetwork, SIGNAL(gameRun()), this, \
SLOT(showBoard())); @@ -537,4 +560,27 @@
connect(this, SIGNAL(jailCard()), m_atlantikNetwork, SLOT(jailCard()));
connect(this, SIGNAL(jailPay()), m_atlantikNetwork, SLOT(jailPay()));
connect(this, SIGNAL(jailRoll()), m_atlantikNetwork, SLOT(jailRoll()));
+}
+
+void Atlantik::addPortfolioView(Player *player)
+{
+ PortfolioView *portfolioView = new PortfolioView(m_atlanticCore, player, \
m_config.activeColor, m_config.inactiveColor, m_portfolioWidget); \
+ m_portfolioViews.append(portfolioView); +
+ connect(player, SIGNAL(changed(Player *)), portfolioView, SLOT(playerChanged()));
+ connect(portfolioView, SIGNAL(newTrade(Player *)), m_atlantikNetwork, \
SLOT(newTrade(Player *))); + connect(portfolioView, SIGNAL(estateClicked(Estate *)), \
m_board, SLOT(prependEstateDetails(Estate *))); +
+ m_portfolioLayout->addWidget(portfolioView);
+ portfolioView->show();
+}
+
+PortfolioView *Atlantik::findPortfolioView(Player *player)
+{
+ PortfolioView *portfolioView = 0;
+ for (QPtrListIterator<PortfolioView> it(m_portfolioViews); (portfolioView = *it) ; \
++it) + if (player == portfolioView->player())
+ return portfolioView;
+
+ return 0;
}
Index: atlantik.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/atlantik.h,v
retrieving revision 1.51
retrieving revision 1.51.6.1
diff -u -d -r1.51 -r1.51.6.1
--- atlantik.h 11 Sep 2002 03:39:10 -0000 1.51
+++ atlantik.h 20 Jan 2003 23:47:36 -0000 1.51.6.1
@@ -1,4 +1,4 @@
-// Copyright (c) 2002 Rob Kaper <cap@capsi.com>
+// Copyright (c) 2002-2003 Rob Kaper <cap@capsi.com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -167,9 +167,10 @@
void newTrade(Trade *trade);
void newAuction(Auction *auction);
+ void removeGUI(Player *player);
void removeGUI(Trade *trade);
- void playerChanged();
+ void playerChanged(Player *player);
signals:
void rollDice();
@@ -182,6 +183,8 @@
private:
void initNetworkObject();
+ void addPortfolioView(Player *player);
+ PortfolioView *findPortfolioView(Player *player);
QWidget *m_mainWidget, *m_portfolioWidget;
QGridLayout *m_mainLayout;
_______________________________________________
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