diff --git a/kdegames-4.1.0-fix-bovo.patch b/kdegames-4.1.0-fix-bovo.patch new file mode 100644 index 0000000..a8b3dd7 --- /dev/null +++ b/kdegames-4.1.0-fix-bovo.patch @@ -0,0 +1,403 @@ +Index: bovo/gui/mark.h +=================================================================== +--- bovo/gui/mark.h (revision 794126) ++++ bovo/gui/mark.h (working copy) +@@ -45,9 +45,10 @@ + ~Mark(); + void killAnimation(); + void kill(); +- usi x() const; +- usi y() const; ++ usi row() const; ++ usi col() const; + void setFill(qreal fill); ++ QRectF boundingRect() const; + + public slots: + void tick(); +@@ -61,7 +62,6 @@ + QWidget* widget=0); + + private: +- QRectF glyphRectF() const; + Scene* m_scene; + int m_row; + int m_col; +Index: bovo/gui/scene.cc +=================================================================== +--- bovo/gui/scene.cc (revision 794126) ++++ bovo/gui/scene.cc (working copy) +@@ -48,7 +48,7 @@ + namespace gui { + + Scene::Scene(const Theme& theme, bool animation) +- : m_activate(false), m_game(0), m_player(No), m_animation(animation), ++ : m_activate(false), m_game(0), m_curCellSize(10.0), m_player(No), m_animation(animation), + m_paintMarker(false) { + /** @todo read theme from some configuration, I guess */ + /** @todo read file names from from some configuration, I guess */ +@@ -58,8 +58,7 @@ + m_hintTimer = new QTimer(this); + m_hintTimer->setSingleShot(true); + m_hintItem = 0; +- resizeScene(static_cast(m_curCellSize*(NUMCOLS+2)), +- static_cast(m_curCellSize*(NUMCOLS+2))); ++ setSceneRect( 0, 0, m_curCellSize*(NUMCOLS+2), m_curCellSize*(NUMCOLS+2) ); + } + + Scene::~Scene() { +@@ -76,6 +75,10 @@ + } + } + ++qreal Scene::squareSize() const { ++ return m_curCellSize; ++} ++ + void Scene::loadTheme(const Theme& theme) { + m_fill = theme.fill(); + QColor color(theme.backgroundColor()); +@@ -90,12 +93,10 @@ + else + m_renderer->load(theme.svg()); + QList allMarks = items(); +- QList::iterator it = allMarks.begin(); +- QList::iterator end = allMarks.end(); +- for (; it != end; ++it) { +- if (Mark* mark = qgraphicsitem_cast(*it)) ++ foreach (QGraphicsItem* item, allMarks) { ++ if (Mark* mark = qgraphicsitem_cast(item)) + mark->setFill(m_fill); +- else if (HintItem* hintItem = qgraphicsitem_cast(*it)) ++ else if (HintItem* hintItem = qgraphicsitem_cast(item)) + hintItem->setFill(m_fill); + } + } +@@ -116,13 +117,6 @@ + invalidate(0, 0, width(), height()); + } + +-void Scene::resizeScene(int width, int height) { +- int size = qMin(width, height); +- setSceneRect( 0, 0, size, size ); +- m_curCellSize = static_cast(size) / +- static_cast(NUMCOLS+2); +-} +- + void Scene::setGame(Game* game) { + destroyHint(); + m_winningMoves = QList(); +@@ -155,14 +149,11 @@ + Mark* mark = new Mark(this, move, m_animation, m_fill); + mark->setSharedRenderer(m_renderer); + addItem(mark); +- demandRepaint(); + } else if (move.player() == No) { + QList allMarks = items(); +- QList::iterator it = allMarks.begin(); +- QList::iterator end = allMarks.end(); +- for (; it != end; ++it) { +- if (Mark* mark = qgraphicsitem_cast(*it)) { +- if (mark->x() == move.x() && mark->y() == move.y()) { ++ foreach (QGraphicsItem* item, allMarks) { ++ if (Mark* mark = qgraphicsitem_cast(item)) { ++ if (mark->row() == move.x() && mark->col() == move.y()) { + if (m_animation) { + connect(mark, SIGNAL(killed(Mark*)), + this, SLOT(killMark(Mark*))); +@@ -170,8 +161,6 @@ + } else { + removeItem(mark); + delete mark; +- demandRepaint(); +- return; + } + } + } +@@ -203,15 +192,17 @@ + m_renderer->render(p, "grid", tmpRect); + } + +-void Scene::drawForeground(QPainter *p, const QRectF&) { ++void Scene::drawForeground(QPainter *p, const QRectF& bounds) { + if (m_paintMarker) { + QRectF rect(cellTopLeft(m_col, m_row), QSizeF(m_curCellSize, + m_curCellSize)); + qreal adjusting((1.0-m_fill)*m_curCellSize/2.0); + rect.adjust(adjusting, adjusting, -adjusting, -adjusting); +- p->setOpacity(0.4); +- m_renderer->render(p, "x1", rect); +- p->setOpacity(1); ++ if (bounds.intersects(rect)) { ++ p->setOpacity(0.4); ++ m_renderer->render(p, "x1", rect); ++ p->setOpacity(1); ++ } + } + if (!m_winningMoves.empty()) { + QList::const_iterator it = m_winningMoves.begin(); +@@ -219,7 +210,9 @@ + while (it != end) { + QRectF tmpRect(cellTopLeft(it->x(), it->y()), QSizeF(m_curCellSize, + m_curCellSize)); +- m_renderer->render(p, "win", tmpRect); ++ if (bounds.intersects(tmpRect)) { ++ m_renderer->render(p, "win", tmpRect); ++ } + ++it; + } + } +@@ -307,7 +300,6 @@ + addItem(m_hintItem); + connect(m_hintTimer, SIGNAL(timeout()), this, SLOT(hintTimeout())); + m_hintTimer->start(2000); +- demandRepaint(); + } + + void Scene::destroyHint() { +@@ -318,7 +310,6 @@ + removeItem(m_hintItem); + m_hintItem->deleteLater(); + m_hintItem = 0; +- demandRepaint(); + } + } + +@@ -347,7 +338,6 @@ + void Scene::killMark(Mark* mark) { + removeItem(mark); + mark->deleteLater(); +- demandRepaint(); + } + + void Scene::replay() { +Index: bovo/gui/scene.h +=================================================================== +--- bovo/gui/scene.h (revision 794126) ++++ bovo/gui/scene.h (working copy) +@@ -52,9 +52,11 @@ + ~Scene(); + void activate(bool activate); + void setGame(Game* game); +- void resizeScene(int width, int height); + bool isBusy() const; + void setTheme(const Theme& theme); ++ qreal squareSize() const; ++ QPointF cellCenter( int x, int y ) const; ++ QPointF cellTopLeft( int x, int y ) const; + + public slots: + void updateBoard(const Move& move); +@@ -78,8 +80,6 @@ + virtual void drawForeground(QPainter *p, const QRectF& rect); + virtual void mousePressEvent(QGraphicsSceneMouseEvent*); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*); +- QPointF cellCenter( int x, int y ) const; +- QPointF cellTopLeft( int x, int y ) const; + void killAnimations(); + bool m_activate; + Game *m_game; +Index: bovo/gui/view.cc +=================================================================== +--- bovo/gui/view.cc (revision 794126) ++++ bovo/gui/view.cc (working copy) +@@ -48,7 +48,7 @@ + } + + void View::resizeEvent( QResizeEvent* ev ) { +- m_scene->resizeScene( ev->size().width(), ev->size().height() ); ++ fitInView(sceneRect(), Qt::KeepAspectRatio); + QGraphicsView::resizeEvent(ev); + } + +Index: bovo/gui/hintitem.cc +=================================================================== +--- bovo/gui/hintitem.cc (revision 794126) ++++ bovo/gui/hintitem.cc (working copy) +@@ -52,6 +52,8 @@ + } else { + m_opacity = 0.4; + } ++ ++ setPos(m_scene->cellCenter(m_col, m_row)); + } + + HintItem::~HintItem() { +@@ -62,12 +64,23 @@ + } + } + ++QRectF HintItem::boundingRect() const { ++ qreal width = m_scene->squareSize(); ++ qreal height = width; ++ qreal margin = (1.0-m_fill) * width / 2.0; ++ return QRectF( -width / 2.0 + margin, ++ -height / 2.0 + margin, ++ width - 2.0*margin, ++ height - 2.0*margin); ++} ++ ++ + void HintItem::killAnimation() { + if (m_ticker) { + m_ticker->stop(); + disconnect(m_ticker, 0, this, 0); + m_opacity = 0.4; +- m_scene->demandRepaint(); ++ update(); + } + } + +@@ -78,7 +91,7 @@ + + void HintItem::killTick() { + m_opacity -= 0.05; +- m_scene->demandRepaint(); ++ update(); + if (m_opacity <= 0.05) { + m_ticker->stop(); + emit killed(); +@@ -98,7 +111,7 @@ + } else { + m_opacity -= 0.1; + } +- m_scene->demandRepaint(); ++ update(); + } + } + +@@ -106,20 +119,9 @@ + // m_enabled = enabled; + // } + +-QRectF HintItem::glyphRectF() const { +- qreal width = m_scene->width() / (NUMCOLS+2); +- qreal height = width; +- qreal margin = (1.0-m_fill) * width / 2.0; +- // qreal margin = m_sizeShrink * width; +- return QRectF( (1+m_col) * width + margin, +- (1+m_row) * height + margin, +- width - 2.0*margin, +- height - 2.0*margin); +-} +- + void HintItem::paint(QPainter *p, const QStyleOptionGraphicsItem*, QWidget*) { + p->setOpacity(m_opacity); +- renderer()->render(p, elementId(), glyphRectF()); ++ renderer()->render(p, elementId(), boundingRect()); + } + + void HintItem::setFill(qreal fill) { +Index: bovo/gui/hintitem.h +=================================================================== +--- bovo/gui/hintitem.h (revision 794126) ++++ bovo/gui/hintitem.h (working copy) +@@ -45,6 +45,7 @@ + void killAnimation(); + void kill(); + void setFill(qreal fill); ++ QRectF boundingRect() const; + + public slots: + void tick(); +@@ -57,7 +58,6 @@ + void paint(QPainter* p, const QStyleOptionGraphicsItem*, QWidget* widget=0); + + private: +- QRectF glyphRectF() const; + Scene* m_scene; + int m_row; + int m_col; +Index: bovo/gui/mark.cc +=================================================================== +--- bovo/gui/mark.cc (revision 794126) ++++ bovo/gui/mark.cc (working copy) +@@ -50,6 +50,8 @@ + } else { + m_opacity = 1.0; + } ++ ++ setPos(m_scene->cellCenter(m_col, m_row)); + } + + Mark::~Mark() { +@@ -60,6 +62,16 @@ + } + } + ++QRectF Mark::boundingRect() const { ++ qreal width = m_scene->squareSize(); ++ qreal height = width; ++ qreal margin = (1.0-m_fill) * width / 2.0; ++ return QRectF( -width / 2.0 + margin, ++ -height / 2.0 + margin, ++ width - 2.0*margin, ++ height - 2.0*margin); ++} ++ + void Mark::killAnimation() { + if (m_ticker != 0) { + m_ticker->stop(); +@@ -67,7 +79,7 @@ + m_ticker->deleteLater(); + m_ticker = 0; + m_opacity = 1.0; +- m_scene->demandRepaint(); ++ update(); + } + } + +@@ -84,7 +96,7 @@ + + void Mark::killTick() { + m_opacity -= 0.1; +- m_scene->demandRepaint(); ++ update(); + if (m_opacity <= 0.1) { + m_ticker->stop(); + emit killed(this); +@@ -97,39 +109,25 @@ + killAnimation(); + } else { + m_opacity += 0.1; +- m_scene->demandRepaint(); ++ update(); + } + } + +-QRectF Mark::glyphRectF() const { +-// m_sS = 1/12 +-// m_fill = 1 || 0.75 +-// marg = 1 - m_fill / 3 +-// totalMarg = 3/12 = 1/4 +-// +- qreal width = m_scene->width() / (NUMCOLS+2); +- qreal height = width; +- qreal margin = (1.0-m_fill) * width / 2.0; +- return QRectF( (1+m_col) * width + margin, +- (1+m_row) * height + margin, +- width - 2.0*margin, +- height - 2.0*margin); +-} +- + void Mark::paint(QPainter *p, const QStyleOptionGraphicsItem*, QWidget*) { + p->setOpacity(m_opacity); +- renderer()->render(p, elementId(), glyphRectF()); ++ renderer()->render(p, elementId(), boundingRect()); + } + + void Mark::setFill(qreal fill) { + m_fill = fill; ++ prepareGeometryChange(); + } + +-usi Mark::x() const { ++usi Mark::col() const { + return m_col; + } + +-usi Mark::y() const { ++usi Mark::row() const { + return m_row; + } + diff --git a/kdegames.spec b/kdegames.spec index 73b8b30..f4c2d79 100644 --- a/kdegames.spec +++ b/kdegames.spec @@ -5,7 +5,7 @@ Name: kdegames Summary: K Desktop Environment 4 - Games Epoch: 6 Version: 4.1.0 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 URL: http://www.kde.org/ @@ -15,6 +15,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # Invert the search order for libkdegames to make sure the KDE 4 version is always found first Patch0: kdegames-3.97.0-parallel_devel.patch +# Fix #457944/kde#160419 Bovo doesn't draw placed marks +Patch1: kdegames-4.1.0-fix-bovo.patch Obsoletes: kdegames4 < %{version}-%{release} Provides: kdegames4 = %{version}-%{release} @@ -39,6 +41,7 @@ Requires(postun): xdg-utils %description Games for the K Desktop Environment 4, including: +* bovo * katomic * kbackgammon * kbattleship @@ -47,8 +50,9 @@ Games for the K Desktop Environment 4, including: * kbounce * kbreakout * kdiamond +* kfourinline * kgoldrunner -* kirki +* kiriki * kjumpingcube * klines * kmahjongg @@ -67,7 +71,6 @@ Games for the K Desktop Environment 4, including: * ksudoku * ktuberling * kubrick -* kwin4 * lskat %package libs @@ -91,6 +94,7 @@ game applications for KDE 4. %prep %setup -q -n kdegames-%{version} %patch0 -p1 -b .parallel_devel +%patch1 -p0 -b .fix-bovo %build @@ -187,6 +191,10 @@ rm -rf %{buildroot} %changelog +* Sat Aug 09 2008 Kevin Kofler 4.1.0-2 +- fix Bovo not drawing placed marks (#457944, kde#160419) +- update/fix game list in description + * Wed Jul 23 2008 Than Ngo 4.1.0-1 - 4.1.0