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

List:       kde-commits
Subject:    branches/work/kreversi_rewrite
From:       Dmitry Suzdalev <dimsuz () gmail ! com>
Date:       2006-08-17 11:45:54
Message-ID: 1155815154.221480.12605.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 573869 by dimsuz:

Allow undo to be done only if scene isn't busy with some animation or whatever


 M  +5 -0      kreversiscene.cpp  
 M  +9 -0      kreversiscene.h  
 M  +3 -2      mainwindow.cpp  


--- branches/work/kreversi_rewrite/kreversiscene.cpp #573868:573869
@@ -45,6 +45,11 @@
     updateBoard();
 }
 
+bool KReversiScene::isBusy() const
+{
+    return m_animTimer->isActive();
+}
+
 void KReversiScene::updateBoard()
 {
     for(int row=0; row<8; ++row)
--- branches/work/kreversi_rewrite/kreversiscene.h #573868:573869
@@ -31,6 +31,15 @@
     KReversiScene( KReversiGame* game, const QPixmap& chipsPixmap );
     void setGame( KReversiGame* game );
     void setBackgroundPixmap( const QPixmap& pix );
+    /**
+     *  This function will tell you if the scene is currently performing
+     *  some kind of "better-don't-interrupt-me" operation.
+     *
+     *  For example this call is used in KReversiMainWindow to decide
+     *  whether it is feasible to perform undo action (which makes a little sence
+     *  during, for example animation of computer move)
+     */
+    bool isBusy() const;
 public slots:
     void updateBoard();
     void slotMoveFinished();
--- branches/work/kreversi_rewrite/mainwindow.cpp #573868:573869
@@ -96,8 +96,9 @@
 
 void KReversiMainWindow::slotUndo()
 {
-    // scene will automatically notice that it needs to update
-    m_game->undo();
+    if( !m_scene->isBusy() )
+        // scene will automatically notice that it needs to update
+        m_game->undo();
 }
 
 #include "mainwindow.moc"
[prev in list] [next in list] [prev in thread] [next in thread] 

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