changeset 64:b8be8b0e0c4b

connect fileLoaded() only one time to requestFinished() (bug) add comment
author lbajardsilogic
date Fri, 08 Jun 2007 13:02:59 +0000
parents 23d2b3acff2c
children 78abce641ddf
files sv/main/EasaierSessionManager.cpp
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/sv/main/EasaierSessionManager.cpp	Fri Jun 08 09:51:32 2007 +0000
+++ b/sv/main/EasaierSessionManager.cpp	Fri Jun 08 13:02:59 2007 +0000
@@ -36,7 +36,9 @@
 	m_document(0),
 	m_audioSourceInfoModel(0),
 	m_queryModel(0)
-{}
+{
+	connect(m_httpClient, SIGNAL(requestFinished(int, bool)), this, SLOT(fileLoaded(int, bool)));
+}
 
 EasaierSessionManager::~EasaierSessionManager()
 {
@@ -84,13 +86,12 @@
 
 	while (!m_loadFile.empty())
 	{
+		m_loadFile.begin()->second->close();
 		delete m_loadFile.begin()->second;
 	    m_loadFile.erase(m_loadFile.begin());
 	}
 
 	m_modelLoaded.clear();
-	
-	disconnect(m_httpClient, SIGNAL(requestFinished(int, bool)), this, SLOT(fileLoaded(int, bool)));
 }
 
 void EasaierSessionManager::closeSession()
@@ -135,14 +136,12 @@
 	newFile->setFileType(type);
 	newFile->setUri(uri);
 
-	std::cerr << "Ask for file : GET " << path.toStdString() << std::endl;
-
 	int index = m_httpClient->get(path, newFile);
 
+	std::cerr << "Ask for file : GET " << path.toStdString() << " - index : " << index << std::endl;
+
 	m_loadFile[index] = newFile;
 
-	connect(m_httpClient, SIGNAL(requestFinished(int, bool)), this, SLOT(fileLoaded(int, bool)));
-
 	if (type == LoadedFile::QUERY_RESULTS)
 		MainWindow::instance()->statusBar()->showMessage(tr("Querying database..."));
 	else if (type == LoadedFile::QUERY_CONFIG)
@@ -157,6 +156,7 @@
 	std::map<int , LoadedFile*>::iterator iter = m_loadFile.find(index);
 	if (iter == m_loadFile.end())
 	{
+		std::cerr << "fileLoaded() : file " << index << " not found. " << std::endl;
 		return;
 	}
 	if (error)
@@ -179,6 +179,8 @@
 	delete loadedFile;
 	m_loadFile.erase(iter);
 
+	std::cerr << "fileLoaded() : file loaded, start to read file " << index << std::endl;
+
 	if ((type == LoadedFile::QUERY_RESULTS) || (type == LoadedFile::QUERY_CONFIG))
 	{
 		MainWindow::instance()->statusBar()->clearMessage();
@@ -253,6 +255,9 @@
 			QMessageBox::critical(MainWindow::instance(), tr("Download Error"), file.readAll());
 		}
 	}
+	else {
+		std::cerr << "fileLoaded() : " << index << " all successful. " << std::endl;
+	}
 }
 
 void EasaierSessionManager::loadRelatedModel()