[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kwordquiz/src
From: Martin Pfeiffer <hubipete () gmx ! net>
Date: 2005-07-11 17:18:34
Message-ID: 1121102314.374111.25821.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 433743 by mpfeiffer:
more bugs fixed+cleanup
M +37 -5 leitnersystem.cpp
M +0 -1 leitnersystemview.h
--- branches/work/kwordquiz/src/leitnersystem.cpp #433742:433743
@@ -104,12 +104,21 @@
void LeitnerSystem::deleteBox( int box )
{
- m_boxes.remove( m_boxes.at( box ) );
+ deleteBox( &(*m_boxes.at( box )) );
}
void LeitnerSystem::deleteBox( LeitnerBox* box )
{
- m_boxes.remove( *box );
+ for( int i = 0; i < m_boxes.count(); i++ )
+ {
+ if( m_boxes[i].getCorrectWordBox() == box )
+ m_boxes[i].setCorrectWordBox( 0 );
+
+ if( m_boxes[i].getWrongWordBox() == box )
+ m_boxes[i].setWrongWordBox( 0 );
+ }
+
+ m_boxes.remove( *box );
}
bool LeitnerSystem::insertBox( const QString& name, int correctWordBox, int wrongWordBox )
@@ -133,8 +142,9 @@
int LeitnerSystem::getNumber( LeitnerBox* box )
{
- if( m_boxes.findIndex( *box ) == -1 )
- kdDebug() << "muhaha" << endl;
+ if( box == 0 )
+ return -1;
+
return m_boxes.findIndex( *box );
}
@@ -169,7 +179,6 @@
LeitnerBox tmpBox;
tmpBox.setBoxName( name );
- //tmpBox.setVocabCount( count );
m_boxes.append( tmpBox );
return true;
@@ -189,3 +198,26 @@
{
return getBoxWithNumber( i )->getBoxName();
}
+
+void LeitnerSystem::setBoxVocabCount( QString& box, int vocabCount )
+{
+ getBoxWithName( box )->setVocabCount( vocabCount );
+}
+
+int LeitnerSystem::getBoxVocabCount( QString& box )
+{
+ return getBoxWithName( box )->getVocabCount();
+}
+
+void LeitnerSystem::incrementBoxVocabCount( QString& box )
+{
+ int tmp = getBoxWithName( box )->getVocabCount();
+ getBoxWithName( box )->setVocabCount( tmp++ );
+}
+
+void LeitnerSystem::decrementBoxVocabCount( QString& box )
+{
+ int tmp = getBoxWithName( box )->getVocabCount();
+ getBoxWithName( box )->setVocabCount( tmp-- );
+}
+
--- branches/work/kwordquiz/src/leitnersystemview.h #433742:433743
@@ -48,7 +48,6 @@
void drawConnections(QPainter*); //paints the arrows between the boxes
void calculateSize();
- //QRect m_viewArea;
int m_imageY; //high border of the images
int m_distPixmap;
int m_highlightedBox; //the box which is currently highlighted
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic