changeset 153:98df77b4f041

add pdf icon for related media and restrain image size
author lbajardsilogic
date Thu, 15 Nov 2007 09:44:32 +0000
parents 46688275b5d4
children 1b8f08375391
files sv/icons/icon_pdf.png sv/sound-access.qrc sv/sound_access.vcproj widgets/RelatedMediaWidget.cpp
diffstat 4 files changed, 48 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
Binary file sv/icons/icon_pdf.png has changed
--- a/sv/sound-access.qrc	Thu Nov 15 09:19:15 2007 +0000
+++ b/sv/sound-access.qrc	Thu Nov 15 09:44:32 2007 +0000
@@ -65,22 +65,22 @@
     <file>icons/interval.png</file>
     <file>icons/connected.png</file>
     <file>icons/notconnected.png</file>
-
-	<file>icons/layerViewer_btn_config.png</file>
-	<file>icons/layerViewer_btn_down.png</file>
-	<file>icons/layerViewer_btn_new.png</file>
-	<file>icons/layerViewer_btn_remove.png</file>
-	<file>icons/layerViewer_btn_up.png</file>
-	<file>icons/drag.png</file>
-	<file>icons/easaier.png</file>
-	<file>icons/splashscreen.png</file>
-	<file>icons/musicIcon.png</file>
-	<file>icons/speechIcon.png</file>
-	<file>icons/prev.png</file>
-	<file>icons/similar.png</file>
-  <file>icons/addToLayer.png</file>
-
-  <file>samples/bass.wav</file>
+	  <file>icons/layerViewer_btn_config.png</file>
+	  <file>icons/layerViewer_btn_down.png</file>
+	  <file>icons/layerViewer_btn_new.png</file>
+	  <file>icons/layerViewer_btn_remove.png</file>
+	  <file>icons/layerViewer_btn_up.png</file>
+	  <file>icons/drag.png</file>
+	  <file>icons/easaier.png</file>
+	  <file>icons/splashscreen.png</file>
+	  <file>icons/musicIcon.png</file>
+	  <file>icons/speechIcon.png</file>
+	  <file>icons/prev.png</file>
+	  <file>icons/similar.png</file>
+    <file>icons/addToLayer.png</file>
+    <file>icons/icon_pdf.png</file>
+  
+    <file>samples/bass.wav</file>
     <file>samples/beep.wav</file>
     <file>samples/bounce.wav</file>
     <file>samples/clap.wav</file>
--- a/sv/sound_access.vcproj	Thu Nov 15 09:19:15 2007 +0000
+++ b/sv/sound_access.vcproj	Thu Nov 15 09:44:32 2007 +0000
@@ -1062,6 +1062,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\icons\icon_pdf.png"
+				>
+			</File>
+			<File
 				RelativePath="icons\instants.png"
 				>
 			</File>
--- a/widgets/RelatedMediaWidget.cpp	Thu Nov 15 09:19:15 2007 +0000
+++ b/widgets/RelatedMediaWidget.cpp	Thu Nov 15 09:44:32 2007 +0000
@@ -55,8 +55,35 @@
 
 void RelatedMediaWidget::addRelatedMedia(const QString &filename)
 {
+	QString imageSource;
+	QString extension = filename.right(filename.length() - (filename.lastIndexOf('.') + 1));
+
+	int width;
+	int height;
+	int maxHeight = 150;
+
+	if (extension == "pdf")
+	{
+		imageSource = ":icons/icon_pdf.png";
+	} else
+	{
+		imageSource = filename;
+	}
+
+	QPixmap image(imageSource);
+	if (image.height() > maxHeight)
+	{
+		height	= maxHeight;
+		width	= image.width() * maxHeight / image.height();
+	} else 
+	{
+		height	= image.height();
+		width	= image.width();
+	}
+
 	QLabel *mediaLabel = new QLabel();
-	mediaLabel->setText("<html><header><style type=\"text/css\">a {text-decoration: none;}</style></header><body><a href=\"" + filename + "\"><img src=\"" + filename + "\">&nbsp;</a></body></html>");
+	mediaLabel->setText("<html><header><style type=\"text/css\">a {text-decoration: none;}</style></header><body><a href=\"" + filename + 
+		"\"><img src=\"" + imageSource + "\" width=\"" + QString::number(width) + "\" height=\"" + QString::number(height) + "\">&nbsp;</a></body></html>");
 	
 	connect(mediaLabel, SIGNAL(linkActivated(QString)), MainWindow::instance(), SLOT(runExternProcess(QString)));