[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.3/kdeedu/kalzium/plasmoid/engine
From: Carsten Niehaus <cniehaus () gmx ! de>
Date: 2009-08-02 9:37:48
Message-ID: 1249205868.891071.13755.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1005821 by cniehaus:
Backport 1005817
"Make the code show random elements, not always Bromine."
M +4 -9 kalzium_engine.cpp
--- branches/KDE/4.3/kdeedu/kalzium/plasmoid/engine/kalzium_engine.cpp #1005820:1005821
@@ -1,5 +1,5 @@
/***************************************************************************
- copyright : (C) 2008 by Carsten Niehaus
+ copyright : (C) 2008, 2009 by Carsten Niehaus
email : cniehaus@kde.org
Copyright 2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
***************************************************************************/
@@ -137,12 +137,12 @@
QString KalziumEngine::generateFact()
{
int rand = m_random->getLong(3);
- qDebug() << "Randrom number is: " << rand;
+ int eNumber = m_random->getLong(95);
- m_currentElement = m_elements.at(34);
+ m_currentElement = m_elements.at(eNumber);
if ( !m_currentElement )
- m_currentElement = m_elements.at(34);
+ return i18n( "An error occurred." );
QString bp = m_currentElement->dataAsString( ChemicalDataObject::boilingpoint );
QString mp = m_currentElement->dataAsString( ChemicalDataObject::meltingpoint ) ;
@@ -152,17 +152,12 @@
switch (rand) {
case 0:
- qDebug() << "0";
return i18n( "Did you know that\n the element %1 has the symbol %2?", name, symbol );
case 1:
- qDebug() << "1";
return i18n( "Did you know that\n %1 (%2) weighs %3 u?", name, symbol, mass );
case 2:
- qDebug() << "2";
return i18n( "Did you know that\n %1 (%2) weighs %3 u?", name, symbol, mass );
- break;
default:
- qDebug() << "default in switch";
return i18n( "Did you know that\n the element %1 has the symbol %2?", name, symbol );
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic