From a89690177c851ddc430702afad9ae90e0c276d10 Mon Sep 17 00:00:00 2001 From: dmacvicar Date: Fri, 30 Nov 2007 11:03:16 +0000 Subject: [PATCH] Ported QY2Settings git-svn-id: http://svn.opensuse.org/svn/yast/branches/tmp/coolo/qt4-port@42535 e0cc52ee-31ee-0310-8b87-e83c4596d67c --- src/CMakeLists.txt | 2 +- src/QY2Settings.cc | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 345259f..60e8c56 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,7 +2,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CUR ADD_DEFINITIONS( -DY2LOG=\\\"QT4\\\" ${QT_DEFINITIONS} --DQT3_SUPPORT +#-DQT3_SUPPORT -DQT_LOCALEDIR=\\\"${CMAKE_INSTALL_PREFIX}/share/qt4/translations\\\" -DICONDIR=\\"${Y2QT_ICONDIR}\\" -DLOCALEDIR=\\\"${Y2QT_LOCALEDIR}\\\" diff --git a/src/QY2Settings.cc b/src/QY2Settings.cc index e62392e..8be7efb 100644 --- a/src/QY2Settings.cc +++ b/src/QY2Settings.cc @@ -112,7 +112,7 @@ QString QY2Settings::get( const QString & key, const QString & fallback ) const if ( it == _currentSection->constEnd() ) return fallback; - return it.data(); + return it.value(); } @@ -156,8 +156,8 @@ bool QY2Settings::load() if ( ! file.open( QIODevice::ReadOnly ) ) { - cerr << "Can't load settings from " << (const char *) _fileName - << ": " << (const char *) file.errorString() + cerr << "Can't load settings from " << qPrintable(_fileName) + << ": " << qPrintable(file.errorString()) << endl; _readError = true; @@ -172,7 +172,7 @@ bool QY2Settings::load() while ( ! file.atEnd() ) { - line = str.readLine().stripWhiteSpace(); + line = str.readLine().trimmed(); lineCount++; @@ -200,8 +200,8 @@ bool QY2Settings::load() { // key=value pair - QString key = line.section( "=", 0, 0 ).stripWhiteSpace(); - QString value = line.section( "=", 1, 1 ).stripWhiteSpace(); + QString key = line.section( "=", 0, 0 ).trimmed(); + QString value = line.section( "=", 1, 1 ).trimmed(); value.replace( QRegExp( "^\"" ), "" ); // strip leading " value.replace( QRegExp( "\"$" ), "" ); // strip trailing " @@ -213,7 +213,7 @@ bool QY2Settings::load() else { qWarning( "%s:%d: Syntax error: %s", - (const char *) _fileName, lineCount, (const char *) line ); + qPrintable( _fileName), lineCount, qPrintable(line) ); } } @@ -232,8 +232,8 @@ bool QY2Settings::save() if ( ! file.open( QIODevice::WriteOnly ) ) { - cerr << "Can't save settings to " << (const char *) _fileName - << ": " << (const char *) file.errorString() + cerr << "Can't save settings to " << qPrintable(_fileName) + << ": " << qPrintable(file.errorString()) << endl; return false; @@ -274,7 +274,7 @@ void QY2Settings::saveSection( Q3TextStream & str, Section * sect ) it != sect->end(); ++it ) { - QString value = it.data(); + QString value = it.value(); value.replace( "\"", "\\\"" ); // Escape embedded " with \" str << it.key() << "= \"" << value << "\"" << endl; -- 2.39.2