[atlantik-cvs] CVS: kdegames/atlantik/libatlantikui auction_widget.cpp, 1.13, 1.14 board.cpp, 1.119, 1.120 estatedetails.cpp, 1.26, 1.27 estatedetails.h, 1.10, 1.11 estateview.cpp, 1.73, 1.74 estateview.h, 1.32, 1.33 portfolioview.cpp, 1.58, 1.59 portfolioview.h, 1.28, 1.29 trade_widget.cpp, 1.43, 1.44
[email protected] Tue, 20 Jan 2004 07:51:33 +0100 (CET)
| Newsgroups | gmane.comp.kde.devel.atlantik |
|---|---|
| Message-ID | <[email protected]> |
Update of /home/kde/kdegames/atlantik/libatlantikui
In directory office:/tmp/cvs-serv26057/libatlantikui
Modified Files:
auction_widget.cpp board.cpp estatedetails.cpp estatedetails.h
estateview.cpp estateview.h portfolioview.cpp portfolioview.h
trade_widget.cpp
Log Message:
Merge atlantik_3_3_branch into HEAD.
Index: auction_widget.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/auction_widget.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- auction_widget.cpp 5 Nov 2003 19:37:20 -0000 1.13
+++ auction_widget.cpp 20 Jan 2004 06:51:30 -0000 1.14
@@ -61,7 +61,7 @@
QPtrList<Player> playerList = m_atlanticCore->players();
for (QPtrListIterator<Player> it(playerList); *it; ++it)
{
- if ((player = *it) && player->gameId() == pSelf->gameId())
+ if ( (player = *it) && player->game() == pSelf->game() )
{
item = new KListViewItem(m_playerList, player->name(), QString("0"));
item->setPixmap(0, QPixmap(SmallIcon("personal")));
Index: board.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/board.cpp,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- board.cpp 5 Nov 2003 23:40:26 -0000 1.119
+++ board.cpp 20 Jan 2004 06:51:30 -0000 1.120
@@ -205,7 +205,7 @@
if (m_atlanticCore)
playerSelf = m_atlanticCore->playerSelf();
- if (playerSelf && playerSelf->gameId() != player->gameId() )
+ if (playerSelf && playerSelf->game() != player->game() )
{
kdDebug() << "addToken ignored - not in same game as playerSelf" << endl;
return;
@@ -236,7 +236,7 @@
if (token)
{
kdDebug() << "playerChanged: tokenLoc " << (token->location() ? token->location()->name() : "none") << endl;
- if (player->isBankrupt() || (playerSelf && playerSelf->gameId() != player->gameId()) )
+ if (player->isBankrupt() || (playerSelf && playerSelf->game() != player->game()) )
token->hide();
if (player->hasTurn())
token->raise();
@@ -554,18 +554,36 @@
if (!estate)
return;
- EstateDetails *eDetails = new EstateDetails(estate, QString::null, this);
- eDetails->addCloseButton();
+ EstateDetails *eDetails = 0;
- if (m_displayQueue.getFirst() != m_lastServerDisplay)
- m_displayQueue.removeFirst();
+ if (m_displayQueue.getFirst() == m_lastServerDisplay)
+ {
+ eDetails = new EstateDetails(estate, QString::null, this);
+ m_displayQueue.prepend(eDetails);
- m_displayQueue.prepend(eDetails);
- updateCenter();
+ connect(eDetails, SIGNAL(buttonCommand(QString)), this, SIGNAL(buttonCommand(QString)));
+ connect(eDetails, SIGNAL(buttonClose()), this, SLOT(displayDefault()));
+ }
+ else
+ {
+ eDetails = dynamic_cast<EstateDetails*> ( m_displayQueue.getFirst() );
+ if (eDetails)
+ {
+ eDetails->setEstate(estate);
+ eDetails->setText( QString::null );
+ // eDetails->clearButtons();
+ }
+ else
+ {
+ kdDebug() << "manual estatedetails with first in queue neither server nor details" << endl;
+ return;
+ }
+ }
- connect(eDetails, SIGNAL(buttonCommand(QString)), this, SIGNAL(buttonCommand(QString)));
- connect(eDetails, SIGNAL(buttonClose()), this, SLOT(displayDefault()));
+ eDetails->addDetails();
+ eDetails->addCloseButton();
+ updateCenter();
}
void AtlantikBoard::updateCenter()
Index: estatedetails.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/estatedetails.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- estatedetails.cpp 25 Nov 2003 00:37:01 -0000 1.26
+++ estatedetails.cpp 20 Jan 2004 06:51:30 -0000 1.27
@@ -59,8 +59,7 @@
m_infoListView->setSorting(-1);
m_mainLayout->addWidget(m_infoListView);
- if (!text.isEmpty())
- appendText(text);
+ appendText(text);
m_buttonBox = new QHBoxLayout(m_mainLayout, KDialog::spacingHint());
m_buttonBox->setMargin(0);
@@ -207,6 +206,37 @@
b_recreate = true;
}
+void EstateDetails::addDetails()
+{
+ if (m_estate)
+ {
+ QListViewItem *infoText = 0;
+
+ // Price
+ if (m_estate->price())
+ {
+ infoText = new QListViewItem(m_infoListView, m_infoListView->lastItem(), i18n("Price: %1").arg(m_estate->price()));
+ infoText->setPixmap(0, QPixmap(SmallIcon("info")));
+ }
+
+ // Owner, houses, isMortgaged
+ if (m_estate && m_estate->canBeOwned())
+ {
+ infoText = new QListViewItem(m_infoListView, m_infoListView->lastItem(), 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, m_infoListView->lastItem(), i18n("Houses: %1").arg(m_estate->houses()));
+ infoText->setPixmap(0, QPixmap(SmallIcon("info")));
+
+ infoText = new QListViewItem(m_infoListView, m_infoListView->lastItem(), i18n("Mortgaged: %1").arg(m_estate->isMortgaged() ? i18n("Yes") : i18n("No")));
+ infoText->setPixmap(0, QPixmap(SmallIcon("info")));
+ }
+ }
+ }
+}
+
void EstateDetails::addButton(QString command, QString caption, bool enabled)
{
KPushButton *button = new KPushButton(caption, this);
@@ -214,6 +244,15 @@
m_buttonCommandMap[(QObject *)button] = command;
m_buttonBox->addWidget(button);
+ if (m_estate)
+ {
+ QColor bgColor, fgColor;
+ bgColor = m_estate->bgColor().light(110);
+ fgColor = ( bgColor.red() + bgColor.green() + bgColor.blue() < 255 ) ? Qt::white : Qt::black;
+
+ button->setPaletteForegroundColor( fgColor );
+ button->setPaletteBackgroundColor( bgColor );
+ }
button->setEnabled(enabled);
button->show();
@@ -237,38 +276,7 @@
{
m_estate = estate;
- setPaletteBackgroundColor(m_estate ? m_estate->bgColor() : Qt::white);
-
- QString columnText = m_estate ? m_estate->name() : QString::null;
- m_infoListView->setColumnText(0, columnText);
-
- // Price
- if (m_estate)
- {
- QListViewItem *infoText = 0;
-
- if (m_estate->price())
- {
- infoText = new QListViewItem(m_infoListView, m_infoListView->lastItem(), i18n("Price: %1").arg(m_estate->price()));
- infoText->setPixmap(0, QPixmap(SmallIcon("info")));
- }
-
- // Owner, houses, isMortgaged
- if (m_estate && m_estate->canBeOwned())
- {
- infoText = new QListViewItem(m_infoListView, m_infoListView->lastItem(), 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, m_infoListView->lastItem(), i18n("Houses: %1").arg(m_estate->houses()));
- infoText->setPixmap(0, QPixmap(SmallIcon("info")));
-
- infoText = new QListViewItem(m_infoListView, m_infoListView->lastItem(), i18n("Mortgaged: %1").arg(m_estate->isMortgaged() ? i18n("Yes") : i18n("No")));
- infoText->setPixmap(0, QPixmap(SmallIcon("info")));
- }
- }
- }
+ m_infoListView->setColumnText( 0, m_estate ? m_estate->name() : QString::null );
b_recreate = true;
update();
@@ -283,13 +291,16 @@
void EstateDetails::appendText(QString text)
{
+ if ( text.isEmpty() )
+ return;
+
QListViewItem *infoText = new QListViewItem(m_infoListView, m_infoListView->lastItem(), text);
if (text.contains("rolls"))
infoText->setPixmap(0, QPixmap(SmallIcon("roll")));
else
infoText->setPixmap(0, QPixmap(SmallIcon("atlantik")));
- m_infoListView->ensureVisible(0, m_infoListView->contentsHeight());
+ m_infoListView->ensureItemVisible( infoText );
}
void EstateDetails::clearButtons()
Index: estatedetails.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/estatedetails.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- estatedetails.h 27 Dec 2002 01:38:08 -0000 1.10
+++ estatedetails.h 20 Jan 2004 06:51:30 -0000 1.11
@@ -41,6 +41,7 @@
~EstateDetails();
Estate *estate() { return m_estate; }
+ void addDetails();
void addButton(const QString command, const QString caption, bool enabled);
void addCloseButton();
void setEstate(Estate *estate);
Index: estateview.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/estateview.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- estateview.cpp 23 Jun 2003 03:05:25 -0000 1.73
+++ estateview.cpp 20 Jan 2004 06:51:30 -0000 1.74
@@ -21,11 +21,13 @@
#include <qcursor.h>
#include <kdebug.h>
-
+#include <kdialogbase.h>
+#include <kglobalsettings.h>
+#include <klocale.h>
#include <kpixmapeffect.h>
-#include <kstandarddirs.h>
#include <kpopupmenu.h>
-#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kstringhandler.h>
#include <player.h>
#include <estate.h>
@@ -51,23 +53,31 @@
m_quartzBlocks = 0;
m_recreateQuartz = true;
- lname = new QTextView(this);
- lname->setBackgroundMode(Qt::NoBackground);
- lname->setAlignment(Qt::AlignCenter);
- lname->setMinimumSize(lname->sizeHint());
- lname->setMinimumWidth(width()-5);
- lname->setMinimumHeight(height()-20);
- lname->setMaximumWidth(width()-5);
- lname->setMaximumHeight(height()-20);
- lname->hide();
-
pe = 0;
updatePE();
icon = new QPixmap(locate("data", "atlantik/pics/" + _icon));
icon = rotatePixmap(icon);
- QToolTip::add(this, m_estate->name());
+ updateToolTip();
+}
+
+void EstateView::updateToolTip()
+{
+ QToolTip::remove(this);
+
+ if ( m_estate )
+ {
+ QString toolTip = m_estate->name();
+ if ( m_estate->isOwned() )
+ toolTip.append( "\n" + i18n("Owner: %1").arg( m_estate->owner()->name() ) );
+ else if ( m_estate->canBeOwned() )
+ toolTip.append( "\n" + i18n("Price: %1").arg( m_estate->price() ) );
+ else if ( m_estate->money() )
+ toolTip.append( "\n" + i18n("Money: %1").arg( m_estate->money() ) );
+
+ QToolTip::add( this, toolTip );
+ }
}
void EstateView::setViewProperties(bool indicateUnowned, bool highliteUnowned, bool darkenMortgaged, bool quartzEffects)
@@ -177,14 +187,13 @@
void EstateView::estateChanged()
{
- lname->setText(m_estate->name());
- QToolTip::remove(this);
- QToolTip::add(this, m_estate->name());
+ updateToolTip();
b_recreate = true;
m_recreateQuartz = true;
- update();
- updatePE();
+
+ update();
+ updatePE();
}
void EstateView::repositionPortfolioEstate()
@@ -375,9 +384,23 @@
}
break;
}
+
+
quartzPainter.end();
delete quartzBuffer;
}
+
+ painter.setFont(QFont(KGlobalSettings::generalFont().family(), KGlobalSettings::generalFont().pointSize(), QFont::Bold));
+// painter.drawText(0, height()/2-15, m_estate->name().section(" ", 0, 0));
+ if (m_estate->color().isValid() && m_orientation == West)
+ painter.drawText( width()/4 + 2, height()/2, KStringHandler::rPixelSqueeze( m_estate->name(), QFontMetrics( QFont( KGlobalSettings::generalFont().family(), KGlobalSettings::generalFont().pointSize(), QFont::Bold ) ), 3*width()/4 ) );
+ else if (m_estate->color().isValid() && m_orientation == East)
+ painter.drawText(2, height()/2, KStringHandler::rPixelSqueeze( m_estate->name(), QFontMetrics( QFont( KGlobalSettings::generalFont().family(), KGlobalSettings::generalFont().pointSize(), QFont::Bold ) ), 3*width()/4 ) );
+ else
+ painter.drawText(2, height()/2, KStringHandler::rPixelSqueeze( m_estate->name(), QFontMetrics( QFont( KGlobalSettings::generalFont().family(), KGlobalSettings::generalFont().pointSize(), QFont::Bold ) ), width() ) );
+
+// painter.drawText(0, height()/2+15, m_estate->name().section(" ", 2, 2));
+
b_recreate = false;
}
bitBlt(this, 0, 0, qpixmap);
@@ -455,13 +478,6 @@
void EstateView::slotResizeAftermath()
{
- lname->setAlignment(Qt::AlignCenter);
- lname->setMinimumSize(lname->sizeHint());
- lname->setMinimumWidth(width()-5);
- lname->setMinimumHeight(height()-20);
- lname->setMaximumWidth(width()-5);
- lname->setMaximumHeight(height()-20);
-
repositionPortfolioEstate();
}
Index: estateview.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/estateview.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- estateview.h 23 Jun 2003 03:05:25 -0000 1.32
+++ estateview.h 20 Jan 2004 06:51:30 -0000 1.33
@@ -19,9 +19,6 @@
#include <qwidget.h>
#include <qpixmap.h>
-#include <qlabel.h>
-
-#include <qtextview.h>
#include <kpixmap.h>
@@ -58,7 +55,9 @@
void resizeEvent(QResizeEvent *);
void mousePressEvent(QMouseEvent *);
- private:
+private:
+ void updateToolTip();
+
QPixmap *rotatePixmap(QPixmap *);
KPixmap *rotatePixmap(KPixmap *);
void drawQuartzBlocks(KPixmap *pi, KPixmap &p, const QColor &c1, const QColor &c2);
@@ -71,7 +70,6 @@
bool b_recreate, m_recreateQuartz;
int m_titleWidth, m_titleHeight;
EstateOrientation m_orientation;
- QTextView *lname;
PortfolioEstate *pe;
private slots:
Index: portfolioview.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/portfolioview.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- portfolioview.cpp 8 Dec 2003 17:10:20 -0000 1.58
+++ portfolioview.cpp 20 Jan 2004 06:51:30 -0000 1.59
@@ -250,13 +250,24 @@
void PortfolioView::mousePressEvent(QMouseEvent *e)
{
- if (e->button()==RightButton && !m_player->isSelf() && m_portfolioEstates.count() )
+ Player *playerSelf = m_atlanticCore->playerSelf();
+
+ if ( e->button()==RightButton && (m_player != playerSelf) )
{
KPopupMenu *rmbMenu = new KPopupMenu(this);
rmbMenu->insertTitle(m_player->name());
- // Start trade
- rmbMenu->insertItem(i18n("Request Trade with %1").arg(m_player->name()), 0);
+ if ( m_portfolioEstates.count() )
+ {
+ // Start trade
+ rmbMenu->insertItem(i18n("Request Trade with %1").arg(m_player->name()), 0);
+ }
+ else
+ {
+ // Kick player
+ rmbMenu->insertItem(i18n("Boot player %1 to lounge").arg(m_player->name()), 0);
+ rmbMenu->setItemEnabled( 0, m_atlanticCore->selfIsMaster() );
+ }
connect(rmbMenu, SIGNAL(activated(int)), this, SLOT(slotMenuAction(int)));
QPoint g = QCursor::pos();
@@ -269,7 +280,10 @@
switch (item)
{
case 0:
- emit newTrade(m_player);
+ if ( m_portfolioEstates.count() )
+ emit newTrade(m_player);
+ else
+ emit kickPlayer(m_player);
break;
}
}
Index: portfolioview.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/portfolioview.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- portfolioview.h 8 Dec 2003 17:10:20 -0000 1.28
+++ portfolioview.h 20 Jan 2004 06:51:31 -0000 1.29
@@ -50,6 +50,7 @@
signals:
void newTrade(Player *player);
+ void kickPlayer(Player *player);
void estateClicked(Estate *);
private slots:
Index: trade_widget.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikui/trade_widget.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- trade_widget.cpp 22 Nov 2003 22:06:39 -0000 1.43
+++ trade_widget.cpp 20 Jan 2004 06:51:31 -0000 1.44
@@ -95,7 +95,7 @@
for (QPtrListIterator<Player> it(playerList); *it; ++it)
{
- if ((player = *it) && player->gameId() == pSelf->gameId())
+ if ((player = *it) && player->game() == pSelf->game())
{
m_playerFromCombo->insertItem(player->name());
m_playerFromMap[m_playerFromCombo->count() - 1] = player;