Skip to content
Permalink
Browse files

Added tab for translator acknowledgement to about box

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10524 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux
timlinux committed Apr 11, 2009
1 parent 084d2c0 commit bfe6c65ed295a9a2e05d004ecd751e1fe977d248
Showing with 89 additions and 0 deletions.
  1. +14 −0 TRANSLATORS
  2. +51 −0 src/app/qgsabout.cpp
  3. +8 −0 src/core/qgsapplication.cpp
  4. +6 −0 src/core/qgsapplication.h
  5. +10 −0 src/ui/qgsabout.ui
@@ -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
@@ -104,6 +104,7 @@ void QgsAbout::init()
listBox1->setCurrentRow( 0 );
}


// read the SPONSORS file and populate the text widget
QFile sponsorFile( QgsApplication::sponsorsFilePath() );
#ifdef QGISDEBUG
@@ -152,6 +153,56 @@ void QgsAbout::init()
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 )
@@ -168,6 +168,14 @@ const QString QgsApplication::sponsorsFilePath()
{
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.
*/
@@ -57,6 +57,12 @@ class CORE_EXPORT QgsApplication: public QApplication
//! 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();

@@ -204,6 +204,16 @@ p, li { white-space: pre-wrap; }
</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" >

0 comments on commit bfe6c65

Please sign in to comment.
You can’t perform that action at this time.