[QGIS Commit] r10524 - in trunk/qgis: . src/app src/core src/ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Apr 11 05:53:39 EDT 2009


Author: timlinux
Date: 2009-04-11 05:53:39 -0400 (Sat, 11 Apr 2009)
New Revision: 10524

Added:
   trunk/qgis/TRANSLATORS
Modified:
   trunk/qgis/src/app/qgsabout.cpp
   trunk/qgis/src/core/qgsapplication.cpp
   trunk/qgis/src/core/qgsapplication.h
   trunk/qgis/src/ui/qgsabout.ui
Log:
Added tab for translator acknowledgement to about box

Added: trunk/qgis/TRANSLATORS
===================================================================
--- trunk/qgis/TRANSLATORS	                        (rev 0)
+++ trunk/qgis/TRANSLATORS	2009-04-11 09:53:39 UTC (rev 10524)
@@ -0,0 +1,14 @@
+# The following are people who have contributed to QGIS 
+# by doing translation work.
+# --------------------------------------------------------
+# Please note that this file is parsed by the about box 
+# for the sponsors list, so names should be strictly 
+# in the format:
+# name|language
+# This list should be sorted by first name. The
+# website entry is optional.
+# -------------------------------------------------------
+#
+# ALWAYS USE UTF-8 WHEN WRITING THIS FILE!
+#
+Werner Macho|German

Modified: trunk/qgis/src/app/qgsabout.cpp
===================================================================
--- trunk/qgis/src/app/qgsabout.cpp	2009-04-11 09:44:05 UTC (rev 10523)
+++ trunk/qgis/src/app/qgsabout.cpp	2009-04-11 09:53:39 UTC (rev 10524)
@@ -104,6 +104,7 @@
       listBox1->setCurrentRow( 0 );
   }
 
+
   // read the SPONSORS file and populate the text widget
   QFile sponsorFile( QgsApplication::sponsorsFilePath() );
 #ifdef QGISDEBUG
@@ -152,6 +153,56 @@
     QgsDebugMsg( QString( "sponsorHTML:%1" ).arg( sponsorHTML.toAscii().constData() ) );
     QgsDebugMsg( QString( "txtSponsors:%1" ).arg( txtSponsors->toHtml().toAscii().constData() ) );
   }
+
+
+  // read the TRANSLATORS file and populate the text widget
+  QFile translatorFile( QgsApplication::translatorsFilePath() );
+#ifdef QGISDEBUG
+  printf( "Reading translators file %s.............................................\n",
+          translatorFile.fileName().toLocal8Bit().constData() );
+#endif
+  if ( translatorFile.open( QIODevice::ReadOnly ) )
+  {
+    QString translatorHTML = ""
+                          + tr( "<p>The following have contributing to QGIS"
+                                " by translating the user interface or documentation</p>" )
+                          + "<hr>"
+                          "<table width='100%'>"
+                          "<tr><th>" + tr( "Name" ) + "</th>"
+                          "<th>" + tr( "Language" ) + "</th></tr>";
+    QString website;
+    QTextStream translatorStream( &translatorFile );
+    // Always use UTF-8
+    translatorStream.setCodec( "UTF-8" );
+    QString sline;
+    while ( !translatorStream.atEnd() )
+    {
+      sline = translatorStream.readLine(); // line of text excluding '\n'
+      //ignore the line if it starts with a hash....
+      if ( sline.left( 1 ) == "#" ) continue;
+      QStringList myTokens = sline.split( "|", QString::SkipEmptyParts );
+      if ( myTokens.size() > 1 )
+      {
+        website = myTokens[1];
+      }
+      else
+      {
+        website = "&nbsp;";
+      }
+      translatorHTML += "<tr>";
+      translatorHTML += "<td>" + myTokens[0] + "</td><td>" + website + "</td>";
+      // close the row
+      translatorHTML += "</tr>";
+    }
+    translatorHTML += "</table>";
+
+    QString myStyle = QgsApplication::reportStyleSheet();
+    txtTranslators->clear();
+    txtTranslators->document()->setDefaultStyleSheet( myStyle );
+    txtTranslators->setHtml( translatorHTML );
+    QgsDebugMsg( QString( "translatorHTML:%1" ).arg( translatorHTML.toAscii().constData() ) );
+    QgsDebugMsg( QString( "txtTranslators:%1" ).arg( txtTranslators->toHtml().toAscii().constData() ) );
+  }
 }
 
 void QgsAbout::setVersion( QString v )

Modified: trunk/qgis/src/core/qgsapplication.cpp
===================================================================
--- trunk/qgis/src/core/qgsapplication.cpp	2009-04-11 09:44:05 UTC (rev 10523)
+++ trunk/qgis/src/core/qgsapplication.cpp	2009-04-11 09:53:39 UTC (rev 10524)
@@ -169,6 +169,14 @@
   return mPkgDataPath + QString( "/doc/SPONSORS" );
 }
 /*!
+  Returns the path to the sponsors file.
+  @note Added in QGIS 1.1
+*/
+const QString QgsApplication::translatorsFilePath()
+{
+  return mPkgDataPath + QString( "/doc/TRANSLATORS" );
+}
+/*!
   Returns the path to the developer image directory.
 */
 const QString QgsApplication::developerPath()

Modified: trunk/qgis/src/core/qgsapplication.h
===================================================================
--- trunk/qgis/src/core/qgsapplication.h	2009-04-11 09:44:05 UTC (rev 10523)
+++ trunk/qgis/src/core/qgsapplication.h	2009-04-11 09:53:39 UTC (rev 10524)
@@ -57,6 +57,12 @@
     //! Returns the path to the sponsors file.
     static const QString sponsorsFilePath();
 
+    /**
+     * Returns the path to the sponsors file.
+     * @note This was added in QGIS 1.1
+     */
+    static const QString translatorsFilePath();
+
     //! Returns the path to the developer image directory.
     static const QString developerPath();
 

Modified: trunk/qgis/src/ui/qgsabout.ui
===================================================================
--- trunk/qgis/src/ui/qgsabout.ui	2009-04-11 09:44:05 UTC (rev 10523)
+++ trunk/qgis/src/ui/qgsabout.ui	2009-04-11 09:53:39 UTC (rev 10524)
@@ -204,6 +204,16 @@
        </item>
       </layout>
      </widget>
+     <widget class="QWidget" name="tab_3" >
+      <attribute name="title" >
+       <string>Translators</string>
+      </attribute>
+      <layout class="QGridLayout" >
+       <item row="0" column="0" >
+        <widget class="QTextBrowser" name="txtTranslators" />
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
    <item row="1" column="0" >



More information about the QGIS-commit mailing list