Skip to content

Commit

Permalink
Added tab for translator acknowledgement to about box
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10524 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Apr 11, 2009
1 parent 084d2c0 commit bfe6c65
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 0 deletions.
14 changes: 14 additions & 0 deletions TRANSLATORS
@@ -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
51 changes: 51 additions & 0 deletions src/app/qgsabout.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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 )
Expand Down
8 changes: 8 additions & 0 deletions src/core/qgsapplication.cpp
Expand Up @@ -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.
*/
Expand Down
6 changes: 6 additions & 0 deletions src/core/qgsapplication.h
Expand Up @@ -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();

Expand Down
10 changes: 10 additions & 0 deletions src/ui/qgsabout.ui
Expand Up @@ -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" >
Expand Down

0 comments on commit bfe6c65

Please sign in to comment.