[Kalzium] KDE/kdeedu/kalzium/src

Carsten Niehaus cniehaus at gmx.de
Sun Jan 1 14:30:10 CET 2006


SVN commit 493090 by cniehaus:

Pino, the problem here is that KGlobal returns 
	kalzium/data/lattice

while it should return 

	/home/kde4/svn/kdeedu/kalzium/data/lattice

Therefore no images will be loaded. Does it work for you without hardcoding the path in KDE4?

CCMAIL:kalzium at kde.org



 M  +14 -1     animatedmoviewidget.cpp  
 M  +1 -1      molcalcwidget.cpp  
 M  +10 -3     simplecrystalviewer.cpp  


--- trunk/KDE/kdeedu/kalzium/src/animatedmoviewidget.cpp #493089:493090
@@ -29,6 +29,7 @@
 #include <kglobal.h>
 #include <kiconloader.h>
 #include <kpushbutton.h>
+#include <kdebug.h>
 
 AnimatedMovieWidget::AnimatedMovieWidget( QWidget *parent )
     : QWidget( parent )
@@ -100,6 +101,7 @@
 
 void AnimatedMovieWidget::setPicturePath( const QString& path )
 {
+	//kdDebug() << "AnimatedMovieWidget::setPicturePath()" << endl;
 	if ( path.isEmpty() )
 		return;
 
@@ -113,6 +115,8 @@
 
 void AnimatedMovieWidget::reloadImages()
 {
+	kdDebug() << "AnimatedMovieWidget::reloadImages() in " << m_picpath << endl;
+
 	m_currentPictureId = 0;
 
 	m_pics.clear();
@@ -122,12 +126,15 @@
 	int i;
 	for ( i = 0; i < tmplist.size(); i++ )
 	{
+		kdDebug() << tmplist[ i ] << endl;
 		if ( imgre.indexIn( tmplist.at( i ) ) > -1 )
 			m_pics << tmplist.at( i );
 	}
 	if ( m_pics.isEmpty() )
 		return;
 	
+	kdDebug() << "reloadImages:: creating the animation" << endl;
+	
 	uint maxlength = 0;
 	for ( i = 0; i < m_pics.size(); i++ )
 	{
@@ -150,15 +157,21 @@
 		m_pix->setPixmap( QPixmap() );
 		m_pix->resize( 100, 100 );
 	}
+	kdDebug() << "reloadImages:: now resize" << endl;
 	resize( minimumSizeHint() );
 }
 
 void AnimatedMovieWidget::loadImage( int id )
 {
+	kdDebug() << "AnimatedMovieWidget::loadImage(), id: " << id  << endl;
+	
 	if ( ( id < 0 ) || ( id >= m_pics.size() ) )
 		return;
 
-	QPixmap tmp( m_picpath + "/" + m_pics.at( id ) );
+	QString tmpFile = m_picpath + "/" + m_pics.at( id );
+	QPixmap tmp( tmpFile );
+	kdDebug() << "loadImage: if check false, tmp-fileName: "<< tmpFile << endl;
+
 	m_pix->setPixmap( tmp );
 	m_pix->resize( tmp.size() );
 }
--- trunk/KDE/kdeedu/kalzium/src/molcalcwidget.cpp #493089:493090
@@ -143,7 +143,7 @@
 
 	// Parse the molecule, and at the same time calculate the total
 	// mass, and the composition of it.
-	m_validInput = m_parser->weight("CO2", &m_mass, &m_elementMap);
+	//m_validInput = m_parser->weight("CO2", &m_mass, &m_elementMap);
 
 	updateUI();
 }
--- trunk/KDE/kdeedu/kalzium/src/simplecrystalviewer.cpp #493089:493090
@@ -25,6 +25,7 @@
 #include <qlabel.h>
 #include <qlayout.h>
 
+#include <kdebug.h>
 #include <kcombobox.h>
 #include <kglobal.h>
 #include <klocale.h>
@@ -57,15 +58,21 @@
 
 	connect( combo, SIGNAL( activated( const QString& ) ), this, SLOT( slotCrystalChanged( const QString& ) ) );
 
-	m_basePath = KGlobal::dirs()->findResourceDir( "data", "kalzium/data/" ) + "kalzium/data/lattice/";
+	//FIXME The path is of course wrong
+	m_basePath = KGlobal::dirs()->findResourceDir( "data", "kalzium/data/" ) + "kalzium/data/lattice";
 
+	kdDebug() << m_basePath << endl;
+
+	m_basePath = "/home/kde4/svn/kdeedu/kalzium/data/lattice";
+
 	QDir dir( m_basePath );
 	QStringList tmplist = dir.entryList();
 	tmplist.removeAll( "." );
 	tmplist.removeAll( ".." );
+
 	for ( int i = 0; i < tmplist.size(); i++ )
 	{
-		QFileInfo fi( m_basePath + tmplist.at( i ) );
+		QFileInfo fi( m_basePath + "/" + tmplist.at( i ) );
 		if ( fi.isDir() )
 			combo->addItem( tmplist.at( i ) );
 	}
@@ -75,7 +82,7 @@
 
 void SimpleCrystalViewer::slotCrystalChanged( const QString& which )
 {
-	m_movie->setPicturePath( m_basePath + which );
+	m_movie->setPicturePath( m_basePath + "/" + which );
 }
 
 #include "simplecrystalviewer.moc"


More information about the Kalzium mailing list