author | zecke <zecke> | 2004-10-15 22:27:30 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-15 22:27:30 (UTC) |
commit | bc127247d5c74f05b58610cbc94ebc8682a16c7f (patch) (unidiff) | |
tree | 433984506aa9b22f916c0ae966956fc53b29197c /library | |
parent | db5e39dbf2e81b3e4e2a7e13fa1a51c34a86e319 (diff) | |
download | opie-bc127247d5c74f05b58610cbc94ebc8682a16c7f.zip opie-bc127247d5c74f05b58610cbc94ebc8682a16c7f.tar.gz opie-bc127247d5c74f05b58610cbc94ebc8682a16c7f.tar.bz2 |
Remove QPEApplication::installTranslator and use qtopia_installTranslator
patch adopted from Qtopia1.7
-rw-r--r-- | library/qpeapplication.cpp | 68 |
1 files changed, 33 insertions, 35 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 0b6d56d..1117240 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -157,5 +157,4 @@ public: | |||
157 | int bigIconSize; | 157 | int bigIconSize; |
158 | 158 | ||
159 | QStringList langs; | ||
160 | QString appName; | 159 | QString appName; |
161 | struct QCopRec | 160 | struct QCopRec |
@@ -759,4 +758,27 @@ void QPEApplication::processQCopFile() | |||
759 | */ | 758 | */ |
760 | 759 | ||
760 | #ifndef QT_NO_TRANSLATION | ||
761 | static void qtopia_loadTranslations( const QStringList& qms ) | ||
762 | { | ||
763 | QStringList langs = Global::languageList(); | ||
764 | |||
765 | for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { | ||
766 | QString lang = *it; | ||
767 | |||
768 | QTranslator * trans; | ||
769 | QString tfn; | ||
770 | |||
771 | for (QStringList::ConstIterator qmit = qms.begin(); qmit!=qms.end(); ++qmit) { | ||
772 | trans = new QTranslator(qApp); | ||
773 | tfn = QPEApplication::qpeDir() + "i18n/" + lang + "/" + *qmit + ".qm"; | ||
774 | if ( trans->load( tfn )) | ||
775 | qApp->installTranslator( trans ); | ||
776 | else | ||
777 | delete trans; | ||
778 | } | ||
779 | } | ||
780 | } | ||
781 | #endif | ||
782 | |||
761 | /*! | 783 | /*! |
762 | Constructs a QPEApplication just as you would construct | 784 | Constructs a QPEApplication just as you would construct |
@@ -846,5 +868,5 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | |||
846 | #endif | 868 | #endif |
847 | #else | 869 | #else |
848 | initApp( argc, argv ); | 870 | initApp( argc, argv ); |
849 | #endif | 871 | #endif |
850 | #ifdef Q_WS_QWS | 872 | #ifdef Q_WS_QWS |
@@ -853,23 +875,10 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | |||
853 | #endif | 875 | #endif |
854 | #ifndef QT_NO_TRANSLATION | 876 | #ifndef QT_NO_TRANSLATION |
877 | QStringList qms; | ||
878 | qms << "libqpe"; | ||
879 | qms << "libopie"; | ||
880 | qms << d->appName; | ||
855 | 881 | ||
856 | d->langs = Global::languageList(); | 882 | qtopia_loadTranslations(qms); |
857 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { | ||
858 | QString lang = *it; | ||
859 | |||
860 | installTranslation( lang + "/libopie.qm"); | ||
861 | installTranslation( lang + "/libqpe.qm" ); | ||
862 | installTranslation( lang + "/" + d->appName + ".qm" ); | ||
863 | |||
864 | |||
865 | //###language/font hack; should look it up somewhere | ||
866 | #ifdef QWS | ||
867 | |||
868 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | ||
869 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | ||
870 | setFont( fn ); | ||
871 | } | ||
872 | #endif | ||
873 | } | ||
874 | #endif | 883 | #endif |
875 | 884 | ||
@@ -904,4 +913,8 @@ void QPEApplication::initApp( int argc, char **argv ) | |||
904 | d->appName = channel; | 913 | d->appName = channel; |
905 | 914 | ||
915 | #ifndef QT_NO_TRANSLATION | ||
916 | qtopia_loadTranslations( QStringList()<<channel ); | ||
917 | #endif | ||
918 | |||
906 | #if QT_VERSION > 235 | 919 | #if QT_VERSION > 235 |
907 | qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 | 920 | qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 |
@@ -935,8 +948,4 @@ void QPEApplication::initApp( int argc, char **argv ) | |||
935 | /* overide stored arguments */ | 948 | /* overide stored arguments */ |
936 | setArgs(argc, argv); | 949 | setArgs(argc, argv); |
937 | |||
938 | /* install translation here */ | ||
939 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) | ||
940 | installTranslation( (*it) + "/" + d->appName + ".qm" ); | ||
941 | } | 950 | } |
942 | #endif | 951 | #endif |
@@ -2180,15 +2189,4 @@ void QPEApplication::tryQuit() | |||
2180 | } | 2189 | } |
2181 | 2190 | ||
2182 | /*! | ||
2183 | \internal | ||
2184 | */ | ||
2185 | void QPEApplication::installTranslation( const QString& baseName ) { | ||
2186 | QTranslator* trans = new QTranslator(this); | ||
2187 | QString tfn = qpeDir() + "/i18n/"+baseName; | ||
2188 | if ( trans->load( tfn ) ) | ||
2189 | installTranslator( trans ); | ||
2190 | else | ||
2191 | delete trans; | ||
2192 | } | ||
2193 | 2191 | ||
2194 | /*! | 2192 | /*! |