changeset 268:ee047fc1a552

if no title is present in the results list, it is replace by "unknown" when a new TIMELINE INFORMATION layer is loaded the sample rate is set up to the main model (WaveFileModel) sample rate.
author lbajardsilogic
date Wed, 25 Jun 2008 09:47:11 +0000
parents c04e768639cf
children 0c8385c5a22e
files data/fileio/ModelReader.cpp sv/main/MainWindow.cpp sv/main/MainWindow.h widgets/QueryResultsWidget.cpp
diffstat 4 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/ModelReader.cpp	Mon Jun 23 15:03:11 2008 +0000
+++ b/data/fileio/ModelReader.cpp	Wed Jun 25 09:47:11 2008 +0000
@@ -23,6 +23,7 @@
 #include "data/model/TextModel.h"
 #include "data/model/IntervalModel.h"
 #include "view/Pane.h"
+#include "main/MainWindow.h"
 
 #include <iostream>
 
@@ -63,7 +64,9 @@
 	m_inBinding(false),
 	m_curBindingName(""),
 	m_sampleRate(44100)
-{}
+{
+	m_sampleRate = MainWindow::instance()->getMainModelSampleRate();
+}
 
 bool ModelHandler::startElement(const QString &namespaceURI, const QString &localName,
 						  const QString &qName, const QXmlAttributes &attributes)
@@ -264,7 +267,8 @@
 		if (iter == m_info.end())
 			return;
 		QString duration = iter->second;
-		long end = duration.mid(2, duration.length()-3).toDouble()*m_sampleRate;
+		long temp = duration.mid(2, duration.length()-3).toDouble();
+		long end = start + duration.mid(2, duration.length()-3).toDouble()*m_sampleRate;
 		//label
 		QString label = "";
 		for (iter = m_info.begin(); iter != m_info.end(); iter++)
@@ -275,6 +279,10 @@
 				label += iter->second + " - ";
 		}
 		//value
+		std::cerr << "modelreader-XML: beginAt = " << beginAt.toStdString() << " duration : " << duration.toStdString() << std::endl;
+		std::cerr << "modelreader-XML: temp = " << temp << std::endl;
+		std::cerr << "modelreader-XML: start = " << start << " end : " << end << std::endl;
+			
 		float value = im->getMeanValue();
 		im->addInterval(start, end, label, value);
 	}
--- a/sv/main/MainWindow.cpp	Mon Jun 23 15:03:11 2008 +0000
+++ b/sv/main/MainWindow.cpp	Wed Jun 25 09:47:11 2008 +0000
@@ -5607,4 +5607,9 @@
 void MainWindow::openSpeechQuery(){
 	m_speechRecognitionUI->show();
 	m_speechRecognitionUI->topLevelWidget();
-}
\ No newline at end of file
+}
+
+size_t MainWindow::getMainModelSampleRate()
+{
+	return getMainModel()->getSampleRate();
+}
--- a/sv/main/MainWindow.h	Mon Jun 23 15:03:11 2008 +0000
+++ b/sv/main/MainWindow.h	Wed Jun 25 09:47:11 2008 +0000
@@ -143,6 +143,8 @@
 
 	float inline getPlaySpeedVal() const { return m_playSpeedVal;}
 
+	size_t getMainModelSampleRate();
+
 signals:
     // Used to toggle the availability of menu actions
     void canAddPane(bool);
--- a/widgets/QueryResultsWidget.cpp	Mon Jun 23 15:03:11 2008 +0000
+++ b/widgets/QueryResultsWidget.cpp	Wed Jun 25 09:47:11 2008 +0000
@@ -202,7 +202,10 @@
 	label += "<a href=\"";
 	label += uri;
 	label += "\">";
-	label += title;
+	if (title != "")
+		label += title;
+	else
+		label += "unknown";
 	label += "</a>\"";
 	labelTitleArtist->setText(label);
 	labelTitleArtist->setWordWrap(true);