From 6dd4069abee9feeefeaf0f4c3b042e11aee735e9 Mon Sep 17 00:00:00 2001
From: "Glenn Y. Rolland" <glenux@glenux.net>
Date: Fri, 3 Aug 2012 00:09:11 +0200
Subject: [PATCH] data: Move all UI text as resource files.

---
 data/text/authors.html |  7 +++++++
 data/text/thanks.html  |  0
 lib/qasim/qasim.qrc    |  2 ++
 lib/qasim/ui/about.rb  | 42 ++++++++++++++++++++++++++++++++++++------
 lib/qasim/ui/about.ui  | 16 +++++++++-------
 5 files changed, 54 insertions(+), 13 deletions(-)
 create mode 100644 data/text/authors.html
 create mode 100644 data/text/thanks.html

diff --git a/data/text/authors.html b/data/text/authors.html
new file mode 100644
index 0000000..3aede20
--- /dev/null
+++ b/data/text/authors.html
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Glenn Y. Rolland</span></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">	E-mail: <a href="mailto:glenux@glenux.net"><span style=" text-decoration: underline; color:#0057ae;">glenux@glenux.net</span></a></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">	Maintainer and Original Author</p></body></html>
diff --git a/data/text/thanks.html b/data/text/thanks.html
new file mode 100644
index 0000000..e69de29
diff --git a/lib/qasim/qasim.qrc b/lib/qasim/qasim.qrc
index ca2da84..a8f3385 100644
--- a/lib/qasim/qasim.qrc
+++ b/lib/qasim/qasim.qrc
@@ -1,5 +1,7 @@
 <RCC>
   <qresource prefix="qasim">
+    <file alias="authors">../../data/text/authors.html</file>
+    <file alias="thanks">../../data/text/thanks.html</file>
     <file alias="licence-gpl3">../../data/text/gpl-3.0-standalone.html</file>
     <file alias="qasim-icon">../../data/icons/qasim.svg</file>
   </qresource>
diff --git a/lib/qasim/ui/about.rb b/lib/qasim/ui/about.rb
index 3bbbe52..3a5bed7 100644
--- a/lib/qasim/ui/about.rb
+++ b/lib/qasim/ui/about.rb
@@ -3,23 +3,53 @@ require 'qasim/ui/about_ui'
 
 module Qasim ; module Ui
 	class About < Qt::Dialog
-		def initialize
+		def initialize(parent = nil)
 			super
-			u = Ui_About.new                                                                                                    
-			u.setup_ui(self)
+			@ui = Ui_About.new                                                                                                    
+			@ui.setup_ui(self)
 
 			#FIXME: attach button events to dialog.close
+			#Qt::Object.connect( w, SIGNAL( :clicked ), a, SLOT( :quit ) )
 			
 			# Change title according to current version
 			title_str = "Qasim v%s (%s)" % [ Qasim::APP_VERSION, Qasim::APP_DATE ]
-			u.title_label.text = Qt::Application.translate(
+			@ui.title_label.text = Qt::Application.translate(
 				"About", 
-				"<html><head/><body><p><span style=\" font-size:11pt; font-weight:600;\">#{title_str}" +
-				"</span></p></body></html>", 
+				title_str, 
 				nil, 
 				Qt::Application::UnicodeUTF8
 			)
 
+			# Read Authors
+			file = Qt::File.new(':/qasim/authors') 
+			if file.open(Qt::File::ReadOnly | Qt::File::Text)
+				stream = Qt::TextStream.new( file )
+				@ui.authors_textedit.text = stream.readAll()	
+				file.close
+			else
+				# FIXME handle error on authors reading
+			end
+
+			# Read Thanks
+			file = Qt::File.new(':/qasim/thanks') 
+			if file.open(Qt::File::ReadOnly | Qt::File::Text)
+				stream = Qt::TextStream.new( file )
+				@ui.thanks_textedit.text = stream.readAll()	
+				file.close
+			else
+				# FIXME handle error on thanks reading
+			end
+
+			# Read License
+			file = Qt::File.new(':/qasim/licence-gpl3') 
+			if file.open(Qt::File::ReadOnly | Qt::File::Text)
+				stream = Qt::TextStream.new( file )
+				@ui.license_textedit.text = stream.readAll()	
+				file.close
+			else
+				# FIXME handle error on licence reading
+			end
+
 			#FIXME: set first tab
 		end
 	end
diff --git a/lib/qasim/ui/about.ui b/lib/qasim/ui/about.ui
index e707505..f9bf9da 100644
--- a/lib/qasim/ui/about.ui
+++ b/lib/qasim/ui/about.ui
@@ -39,8 +39,14 @@
            <verstretch>0</verstretch>
           </sizepolicy>
          </property>
+         <property name="font">
+          <font>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
          <property name="text">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:11pt; font-weight:600;&quot;&gt;Qasim vVERSION (DATE)&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          <string>Qasim vVERSION (DATE)</string>
          </property>
         </widget>
        </item>
@@ -101,7 +107,7 @@
         </attribute>
         <layout class="QVBoxLayout" name="verticalLayout_3">
          <item>
-          <widget class="QTextEdit" name="author_textedit">
+          <widget class="QTextEdit" name="authors_textedit">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
              <horstretch>0</horstretch>
@@ -113,9 +119,7 @@
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
 p, li { white-space: pre-wrap; }
 &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Glenn Y. Rolland&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;	E-mail: &lt;a href=&quot;mailto:glenux@glenux.net&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;glenux@glenux.net&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;	Maintainer and Original Author&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
            </property>
           </widget>
          </item>
@@ -149,8 +153,6 @@ p, li { white-space: pre-wrap; }
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
 p, li { white-space: pre-wrap; }
 &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;THE LICENCE&amp;lt;resource type=&amp;quot;other&amp;quot; file=&amp;quot;:/qasim/LICENSE-GPL-3&amp;quot;/&amp;gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&amp;lt;resource type=&amp;quot;other&amp;quot; file=&amp;quot;:/qasim/LICENSE-GPL-3&amp;quot;/&amp;gt;&lt;/p&gt;
 &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
            </property>
           </widget>