Commit cefd0172 authored by Dmitry Suzdalev's avatar Dmitry Suzdalev

valgrinding helps ;)

svn path=/branches/work/kreversi_rewrite/; revision=581431
parent 2c980f4c
......@@ -10,6 +10,11 @@ KReversiChip::KReversiChip( ChipColor color, const KReversiChipFrameSet* frameSe
setColor(m_color);
}
void KReversiChip::setFrameSet( const KReversiChipFrameSet* frameSet )
{
m_frameSet = frameSet;
}
void KReversiChip::setColor( ChipColor color )
{
m_color = color;
......
......@@ -11,6 +11,7 @@ class KReversiChip : public QGraphicsPixmapItem
{
public:
KReversiChip( ChipColor color, const KReversiChipFrameSet *frameSet, QGraphicsScene *scene );
void setFrameSet( const KReversiChipFrameSet *frameSet );
void setColor( ChipColor color );
ChipColor color() const { return m_color; }
/**
......
......@@ -54,11 +54,17 @@ void KReversiScene::setChipsPixmap( const QPixmap& chipsPixmap )
// FIXME dimsuz: use qgraphicsitem_cast?
chip = dynamic_cast<KReversiChip*>(item);
if( chip )
{
chip->setFrameSet( m_frameSet );
chip->setColor( chip->color() ); // this will reread pixmap
}
}
if(m_hintChip)
{
m_hintChip->setFrameSet( m_frameSet );
m_hintChip->setColor( m_hintChip->color() );
}
}
}
......
......@@ -39,7 +39,9 @@ static QString moveToString( const KReversiMove& move )
}
KReversiMainWindow::KReversiMainWindow(QWidget* parent)
: KMainWindow(parent), m_scene(0), m_game(0), m_undoAct(0), m_hintAct(0), m_demoAct(0)
: KMainWindow(parent), m_scene(0), m_game(0),
m_historyLabel(0), m_historyView(0), m_undoAct(0),
m_hintAct(0), m_demoAct(0)
{
statusBar()->insertItem( i18n("Your turn."), 0 );
......@@ -213,6 +215,11 @@ void KReversiMainWindow::slotNewGame()
m_hintAct->setEnabled( true );
if(m_demoAct)
m_demoAct->setChecked( false );
if(m_undoAct)
m_undoAct->setEnabled( false );
if(m_historyView)
m_historyView->clear();
if(m_scene == 0) // if called first time
{
......
......@@ -35,8 +35,8 @@ private:
KReversiScene *m_scene;
KReversiView *m_view;
KReversiGame *m_game;
QListWidget *m_historyView;
QLabel *m_historyLabel;
QListWidget *m_historyView;
KAction* m_undoAct;
KAction* m_hintAct;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment