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

List:       kde-commits
Subject:    playground/edu/kanagram/src
From:       Joshua Keel <joshuakeel () gmail ! com>
Date:       2005-07-28 20:30:06
Message-ID: 1122582606.761445.12762.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 439754 by jkeel:

Fix a hint timer issue


 M  +8 -3      kanagram.cpp  
 M  +2 -0      kanagram.h  


--- trunk/playground/edu/kanagram/src/kanagram.cpp #439753:439754
@@ -88,6 +88,8 @@
 	m_fontHighlightColor = QColor(99, 99, 99);
 
 	loadSettings();
+
+	m_hintTimer = new QTimer(this);
 	
 	m_helpMenu = new KHelpMenu(this, kapp->aboutData());
 	
@@ -96,6 +98,7 @@
 	m_inputBox->setFrame(false);
 	
 	connect(m_inputBox, SIGNAL(returnPressed()), this, SLOT(checkWord()));
+	connect(m_hintTimer, SIGNAL(timeout()), this, SLOT(hideHint()));
 	
 	QFont f = QFont();
 	f.setPointSize(17);
@@ -130,6 +133,8 @@
 		m_blackboardFont = QFont("squeaky chalk sound");
 
 	m_defaultVocab = KanagramSettings::defaultVocab();
+
+	kdDebug() << "Configuration loaded..." << endl;
 }
 
 void Kanagram::paintEvent(QPaintEvent *)
@@ -282,7 +287,9 @@
 		{
 			if(m_hintHideTime)
 			{
-				QTimer::singleShot( m_hintHideTime * 1000, this, SLOT(hideHint()) );
+				if(m_hintTimer->isActive())
+					m_hintTimer->stop();
+				m_hintTimer->start(m_hintHideTime * 1000, TRUE);
 			}
 			m_showHint = true;
 			randomHintImage();
@@ -295,7 +302,6 @@
 		if(m_inputBox->text() == m_game.getWord())
 		{
 			m_inputBox->unsetPalette();
-			cout << "Correct!" << endl;
 			m_inputBox->clear();
 			m_game.nextAnagram();
 			update();
@@ -304,7 +310,6 @@
 		{
 			m_inputBox->setPaletteBackgroundColor(QColor(255, 0, 0));
 			QTimer::singleShot(2000, this, SLOT(resetInputBox()));
-			cout << "Sorry, try again!" << endl;
 			m_inputBox->clear();
 			update();
 		}
--- trunk/playground/edu/kanagram/src/kanagram.h #439753:439754
@@ -94,6 +94,8 @@
 		KConfigDialog *m_configDialog;
 
 		KRandomSequence m_randomImage;
+
+		QTimer *m_hintTimer;
 };
 
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

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