From 003319e3031c6765d2b2cbd51063a9f66b1f0fd9 Mon Sep 17 00:00:00 2001 From: dmacvicar Date: Fri, 30 Nov 2007 11:03:19 +0000 Subject: [PATCH] ported YQApplication and utf8 git-svn-id: http://svn.opensuse.org/svn/yast/branches/tmp/coolo/qt4-port@42537 e0cc52ee-31ee-0310-8b87-e83c4596d67c --- src/YQApplication.cc | 34 +++++++++++++++++----------------- src/utf8.h | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/YQApplication.cc b/src/YQApplication.cc index 6c75a4d..050b3c9 100644 --- a/src/YQApplication.cc +++ b/src/YQApplication.cc @@ -78,7 +78,7 @@ YQApplication::loadPredefinedQtTranslations() QString language = QLocale::system().name(); QString transFile = QString( "qt_%1.qm") - .arg( language.lower().replace('_','-') ); + .arg( language.toLower().replace('_','-') ); if ( path.isEmpty() ) { @@ -95,19 +95,19 @@ YQApplication::loadPredefinedQtTranslations() if ( _qtTranslations->isEmpty() ) { // try fallback - transFile = QString( "qt_%1.qm").arg( language.lower().left(2) ); + transFile = QString( "qt_%1.qm").arg( language.toLower().left(2) ); _qtTranslations->load( transFile, path ); } if ( _qtTranslations->isEmpty() ) { y2warning( "Can't load translations for predefined Qt dialogs from %s/%s", - (const char *) path, (const char *) transFile ); + qPrintable(path), qPrintable(transFile) ); } else { y2milestone( "Loaded translations for predefined Qt dialogs from %s/%s", - (const char *) path, (const char *) transFile ); + qPrintable(path), qPrintable(transFile) ); qApp->installTranslator( _qtTranslations ); } @@ -117,12 +117,12 @@ YQApplication::loadPredefinedQtTranslations() if ( ( language.startsWith( "ar" ) || // Arabic language.startsWith( "he" ) ) // Hebrew - && ! qApp->reverseLayout() ) + && ! (qApp->layoutDirection() == Qt::RightToLeft) ) { y2warning( "Using fallback rule for reverse layout for language '%s'", - (const char *) language ); + qPrintable(language) ); - qApp->setReverseLayout( true ); + qApp->setLayoutDirection( Qt::RightToLeft ); } } @@ -138,9 +138,9 @@ YQApplication::setLangFonts( const string & language, const string & encoding ) Q_CHECK_PTR( _langFonts ); if ( _langFonts->readError() ) - y2error( "Error reading %s", (const char *) _langFonts->fileName() ); + y2error( "Error reading %s", qPrintable(_langFonts->fileName()) ); else - y2milestone( "%s read OK", (const char *) _langFonts->fileName() ); + y2milestone( "%s read OK", qPrintable(_langFonts->fileName()) ); } QString lang = language.c_str(); @@ -161,25 +161,25 @@ YQApplication::setLangFonts( const string & language, const string & encoding ) if ( _langFonts->hasKey( fontKey( lang ) ) ) { _fontFamily = _langFonts->get( fontKey( lang ), "Sans Serif" ); - y2milestone( "%s = \"%s\"", (const char *) fontKey( lang ), (const char *) _fontFamily ); + y2milestone( "%s = \"%s\"", qPrintable(fontKey( lang )), qPrintable(_fontFamily) ); } else { _fontFamily = _langFonts->get( fontKey( "" ), "Sans Serif" ); y2milestone( "Using fallback for %s: font = \"%s\"", - (const char *) lang, (const char *) _fontFamily ); + qPrintable(lang), qPrintable(_fontFamily) ); } if ( _fontFamily != oldFontFamily && ! _fontFamily.isEmpty() ) { - y2milestone( "New font family: %s", _fontFamily.latin1() ); + y2milestone( "New font family: %s", qPrintable(_fontFamily) ); deleteFonts(); int size = qApp->font().pointSize(); QFont font( _fontFamily ); font.setPointSize( size ); - qApp->setFont( font, true ); // font, informWidgets + qApp->setFont(font); // font, informWidgets y2milestone( "Reloading fonts - now using \"%s\"", - (const char *) font.toString() ); + qPrintable(font.toString()) ); } else { @@ -224,9 +224,9 @@ YQApplication::currentFont() _currentFont->setWeight( QFont::Normal ); y2milestone( "Loaded %d pixel font: %s", _autoNormalFontSize, - (const char *) _currentFont->toString() ); + qPrintable(_currentFont->toString()) ); - qApp->setFont( * _currentFont, true ); // font, informWidgets + qApp->setFont( * _currentFont); // font, informWidgets } else { @@ -270,7 +270,7 @@ YQApplication::headingFont() _headingFont->setWeight( QFont::Bold ); y2milestone( "Loaded %d pixel bold font: %s", _autoHeadingFontSize, - (const char *) _headingFont->toString() ); + qPrintable(_headingFont->toString()) ); } else { diff --git a/src/utf8.h b/src/utf8.h index 246ca9e..311c3c3 100644 --- a/src/utf8.h +++ b/src/utf8.h @@ -35,7 +35,7 @@ inline std::string toUTF8( const QString & str ) if ( str.isEmpty() ) return std::string( "" ); else - return std::string( str.utf8().data() ); + return std::string( str.toUtf8().data() ); } #endif // utf8_h -- 2.39.2