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

List:       kde-commits
Subject:    KDE/kdegames/kolf
From:       Stefan Majewsky <majewsky () gmx ! net>
Date:       2010-10-31 22:15:34
Message-ID: 20101031221534.2B021AC8A3 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1191683 by majewsky:

Kill RectItem class and newSize() methods.

 M  +1 -1      floater.cpp  
 M  +15 -31    game.cpp  
 M  +4 -15     game.h  
 M  +2 -7      slope.cpp  
 M  +1 -2      slope.h  


--- trunk/KDE/kdegames/kolf/floater.cpp #1191682:1191683
@@ -95,7 +95,7 @@
 	setLeftWallVisible(false);
 	setRightWallVisible(false);
 
-	newSize(width(), height());
+	setSize(width(), height());
 	moveBy(0, 0);
 	setSpeed(0);
 
--- trunk/KDE/kdegames/kolf/game.cpp #1191682:1191683
@@ -77,7 +77,7 @@
 
 /////////////////////////
 
-RectPoint::RectPoint(const QColor &color, RectItem *rect, QGraphicsItem * parent)
+RectPoint::RectPoint(const QColor &color, Tagaro::SpriteObjectItem *rect, \
QGraphicsItem * parent)  : QGraphicsEllipseItem(parent)
 {
 	setZValue(9999);
@@ -107,7 +107,7 @@
 	if (nw <= 0 || nh <= 0)
 		return;
 
-	rect->newSize(nw, nh);
+	rect->setSize(nw, nh);
 }
 
 Config *RectPoint::config(QWidget *parent)
@@ -292,7 +292,7 @@
 	editModeChanged(false);
 
 	setSize(defaultSize.width(), defaultSize.height());
-	newSize(width(), height());
+	setSize(width(), height());
 }
 
 void Bridge::resize(double resizeFactor)
@@ -388,7 +388,7 @@
 
 void Bridge::doLoad(KConfigGroup *cfgGroup)
 {
-	newSize(cfgGroup->readEntry("width", width()), cfgGroup->readEntry("height", \
height())); +	setSize(cfgGroup->readEntry("width", width()), \
cfgGroup->readEntry("height", height()));  \
setTopWallVisible(cfgGroup->readEntry("topWallVisible", topWallVisible()));  \
setBotWallVisible(cfgGroup->readEntry("botWallVisible", botWallVisible()));  \
setLeftWallVisible(cfgGroup->readEntry("leftWallVisible", leftWallVisible())); @@ \
-428,11 +428,6 @@  return ret;
 }
 
-void Bridge::newSize(double width, double height)
-{
-	Bridge::setSize(width, height);
-}
-
 void Bridge::setSize(double width, double height)
 {
 	Tagaro::SpriteObjectItem::setSize(width, height);
@@ -532,7 +527,7 @@
 	setLeftWallVisible(true);
 	setRightWallVisible(true);
 
-	newSize(width(), height());
+	setSize(width(), height());
 	moveBy(0, 0);
 }
 
@@ -622,20 +617,15 @@
 	guard->setBetween(x(), x() + width());
 }
 
-void Windmill::setSize(double width, double height)
-{
-	newSize(width, height);
-}
-
 void Windmill::setBottom(bool yes)
 {
 	m_bottom = yes;
-	newSize(width(), height());
+	setSize(width(), height());
 }
 
-void Windmill::newSize(double width, double height)
+void Windmill::setSize(double width, double height)
 {
-	Bridge::newSize(width, height);
+	Bridge::setSize(width, height);
 
 	const double indent = width / 4;
 
@@ -868,12 +858,6 @@
 	moveBy(0, 0); 
 }
 
-void KolfEllipse::newSize(double width, double height)
-{
-	setSize(width, height);
-}
-
-
 void KolfEllipse::setSize(double width, double height)
 {
 	setOffset(-0.5 * width, -0.5 * height);
@@ -2997,10 +2981,10 @@
 	else if( (oldW==newW) && (oldH==newH) )
 		return;
 
-	int newSize = qMin(newW, newH);
-	QGraphicsView::resize(newSize, newSize); //make sure new size is square
+	int setSize = qMin(newW, newH);
+	QGraphicsView::resize(setSize, setSize); //make sure new size is square
 
-// 	resizeAllItems((double)newSize/400.0);
+// 	resizeAllItems((double)setSize/400.0);
 	resizeAllItems(1); //item scaling is now done automatically by Tagaro::Board
 	//TODO: Remove all the manual scaling code.
 }
@@ -3711,10 +3695,10 @@
 	timer->start(timerMsec);
 
 	if(size().width()!=400 || size().height()!=400) { //not default size, so resizing \
                needed
-		int newSize = qMin(size().width(), size().height());
-		//resize needs to be called for newSize+1 first because otherwise it doesn't seem \
                to get called (not sure why) 
-		QGraphicsView::resize(newSize+1, newSize+1);
-		QGraphicsView::resize(newSize, newSize);
+		int setSize = qMin(size().width(), size().height());
+		//resize needs to be called for setSize+1 first because otherwise it doesn't seem \
to get called (not sure why) +		QGraphicsView::resize(setSize+1, setSize+1);
+		QGraphicsView::resize(setSize, setSize);
 	}
 
 	// if (false) { we're done with the round! }
--- trunk/KDE/kdegames/kolf/game.h #1191682:1191683
@@ -151,18 +151,10 @@
 	QGraphicsLineItem *line2;
 };
 
-class RectPoint;
-class RectItem
-{
-public:
-	virtual ~RectItem(){}
-	virtual void newSize(double /*width*/, double /*height*/) {}
-};
-
 class RectPoint : public QGraphicsEllipseItem, public CanvasItem
 {
 public:
-	RectPoint(const QColor &color, RectItem *, QGraphicsItem *parent);
+	RectPoint(const QColor &color, Tagaro::SpriteObjectItem *rect, QGraphicsItem \
*parent);  void dontMove() { dontmove = true; }
 	virtual void moveBy(double dx, double dy);
 	virtual Config *config(QWidget *parent);
@@ -173,14 +165,14 @@
 	void setSize(double, double);
 
 protected:
-	RectItem *rect;
+	Tagaro::SpriteObjectItem *rect;
 	double m_sizeFactor;
 
 private:
 	bool dontmove;
 };
 
-class KolfEllipse : public Tagaro::SpriteObjectItem, public CanvasItem, public \
RectItem +class KolfEllipse : public Tagaro::SpriteObjectItem, public CanvasItem
 {
 public:
 	KolfEllipse(QGraphicsItem *parent, const QString &type);
@@ -199,7 +191,6 @@
 
 	virtual QList<QGraphicsItem *> moveableItems() const;
 
-	virtual void newSize(double width, double height);
 	void setSize(double width, double height);
 
 	virtual void moveBy(double dx, double dy);
@@ -616,7 +607,7 @@
 	Bridge *bridge;
 };
 
-class Bridge : public Tagaro::SpriteObjectItem, public CanvasItem, public RectItem
+class Bridge : public Tagaro::SpriteObjectItem, public CanvasItem
 {
 public:
 	Bridge(QGraphicsItem *parent, const QString &type = QLatin1String("bridge"));
@@ -631,7 +622,6 @@
 	virtual bool vStrut() const { return true; }
 	void doLoad(KConfigGroup *cfgGroup);
 	void doSave(KConfigGroup *cfgGroup);
-	virtual void newSize(double width, double height);
 	virtual void setGame(KolfGame *game);
 	virtual Config *config(QWidget *parent) { return new BridgeConfig(this, parent); }
 	void setSize(double width, double height);
@@ -742,7 +732,6 @@
 public:
 	Windmill(QGraphicsItem *parent);
 	virtual void aboutToDie();
-	virtual void newSize(double width, double height);
 	virtual void save(KConfigGroup *cfgGroup);
 	virtual void load(KConfigGroup *cfgGroup);
 	virtual void setGame(KolfGame *game);
--- trunk/KDE/kdegames/kolf/slope.cpp #1191682:1191683
@@ -131,11 +131,6 @@
 
 void Slope::setSize(double width, double height)
 {
-	newSize(width, height);
-}
-
-void Slope::newSize(double width, double height)
-{
 	if (type == Elliptic)
 	{
 		const double size = qMin(width, height);
@@ -242,7 +237,7 @@
 	grade = cfgGroup->readEntry("grade", grade);
 	reversed = cfgGroup->readEntry("reversed", reversed);
 
-	// bypass updatePixmap which newSize normally does
+	// bypass updatePixmap which setSize normally does
 	Tagaro::SpriteObjectItem::setSize(QSizeF(cfgGroup->readEntry("width", width()), \
cfgGroup->readEntry("height", height())));  updateZ();
 
@@ -379,7 +374,7 @@
 	if (type == Elliptic)
 	{
 		//ensure quadratic shape
-		newSize(width(), height());
+		setSize(width(), height());
 	}
 
 	updatePixmap();
--- trunk/KDE/kdegames/kolf/slope.h #1191682:1191683
@@ -42,7 +42,7 @@
 	Slope *slope;
 };
 
-class Slope : public Tagaro::SpriteObjectItem, public CanvasItem, public RectItem
+class Slope : public Tagaro::SpriteObjectItem, public CanvasItem
 {
 public:
 	Slope(QGraphicsItem *parent);
@@ -56,7 +56,6 @@
 	virtual QList<QGraphicsItem *> moveableItems() const;
 	virtual Config *config(QWidget *parent) { return new SlopeConfig(this, parent); }
 	virtual void setSize(double width, double height);
-	virtual void newSize(double width, double height);
 	virtual void moveBy(double dx, double dy);
 
 	virtual QPainterPath shape () const;


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

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