From 019d87a192caae75afbc99ed02809a750db58446 Mon Sep 17 00:00:00 2001 From: mkr Date: Wed, 6 Jun 2007 05:46:30 +0000 Subject: [PATCH] Porting to Qt4. --- src/Makefile.am | 2 +- src/ResExporter/ResExporter.pro | 17 +++++++++ src/ResExporter/ResourceExporter.cxx | 55 ++++++++++++++-------------- src/src.pro | 2 +- 4 files changed, 46 insertions(+), 30 deletions(-) create mode 100644 src/ResExporter/ResExporter.pro diff --git a/src/Makefile.am b/src/Makefile.am index deb432835..91611e009 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -91,7 +91,7 @@ endif # VSR: this is the original packages list #SUBDIRS += Event LightApp ResExporter # VSR: already migrated to Qt4 packages -SUBDIRS += Event +SUBDIRS += Event ResExporter if GUI_ENABLE_CORBA # VSR: this is the original packages list diff --git a/src/ResExporter/ResExporter.pro b/src/ResExporter/ResExporter.pro new file mode 100644 index 000000000..1f96eae8a --- /dev/null +++ b/src/ResExporter/ResExporter.pro @@ -0,0 +1,17 @@ +TEMPLATE = +TARGET = ResourceExporter +DESTDIR = ../../bin +MOC_DIR = ../../moc +OBJECTS_DIR = ../../obj/$$TARGET + +INCLUDEPATH += ../../include ../Qtx ../SUIT +LIBS += -L../../lib -lqtx -lsuit + +CONFIG -= debug release debug_and_release +CONFIG += qt thread debug dll shared + +win32:DEFINES += WIN32 +DEFINES += + +SOURCES = ResourceExporter.cxx + diff --git a/src/ResExporter/ResourceExporter.cxx b/src/ResExporter/ResourceExporter.cxx index 7788f8b7c..e133594f7 100644 --- a/src/ResExporter/ResourceExporter.cxx +++ b/src/ResExporter/ResourceExporter.cxx @@ -42,10 +42,10 @@ */ #include "SUIT_ResourceMgr.h" -#include -#include -#include -#include +#include +#include +#include +#include #include /*! @@ -59,11 +59,10 @@ static QString salomeVersion() path += QString( "bin/salome/VERSION" ); QFile vf( path ); - if ( !vf.open( IO_ReadOnly ) ) + if ( !vf.open( QIODevice::ReadOnly ) ) return QString::null; - QString line; - vf.readLine( line, 1024 ); + QString line( vf.readLine( 1024 ) ); vf.close(); if ( line.isEmpty() ) @@ -73,9 +72,9 @@ static QString salomeVersion() line.remove( line.length() - 1, 1 ); QString ver; - int idx = line.findRev( ":" ); + int idx = line.lastIndexOf( ":" ); if ( idx != -1 ) - ver = line.mid( idx + 1 ).stripWhiteSpace(); + ver = line.mid( idx + 1 ).trimmed(); return ver; } @@ -117,34 +116,34 @@ int main( int argc, char** argv ) resMgr->setCurrentFormat( QString( "xml" ) ); resMgr->loadLanguage(); for ( int i = 1; i < argc; i ++ ) { - QString anArg = QString( argv[i] ).stripWhiteSpace(); + QString anArg = QString( argv[i] ).trimmed(); if ( anArg.startsWith( "-" ) ) { anArg.remove( 0, 1 ); if ( anArg.contains( ":" ) ) { - QStringList vals = QStringList::split( ":", anArg ); - QString section = vals[ 0 ].stripWhiteSpace(); - QString param = vals[ 1 ].stripWhiteSpace(); + QStringList vals = anArg.split( ":", QString::SkipEmptyParts ); + QString section = vals[ 0 ].trimmed(); + QString param = vals[ 1 ].trimmed(); if ( section.isEmpty() || param.isEmpty() ) continue; resMgr->remove( section, param ); } } else if ( anArg.contains( "+=" ) ) { - QStringList vals = QStringList::split( "+=", anArg ); + QStringList vals = anArg.split( "+=", QString::SkipEmptyParts ); if ( vals[ 0 ].contains( ":" ) ) { - QStringList vals1 = QStringList::split( ":", vals[ 0 ] ); - QString section = vals1[ 0 ].stripWhiteSpace(); - QString param = vals1[ 1 ].stripWhiteSpace(); - QString newValue = vals [ 1 ].stripWhiteSpace(); + QStringList vals1 = vals[ 0 ].split( ":", QString::SkipEmptyParts ); + QString section = vals1[ 0 ].trimmed(); + QString param = vals1[ 1 ].trimmed(); + QString newValue = vals [ 1 ].trimmed(); QString separ = ","; // default separator if ( newValue.contains( "|" ) ) { - QStringList vals2 = QStringList::split( "|", newValue ); - newValue = vals2[ 0 ].stripWhiteSpace(); - separ = vals2[ 1 ].stripWhiteSpace(); + QStringList vals2 = newValue.split( "|", QString::SkipEmptyParts ); + newValue = vals2[ 0 ].trimmed(); + separ = vals2[ 1 ].trimmed(); } if ( section.isEmpty() || param.isEmpty() || newValue.isEmpty() || separ.isEmpty() ) continue; QString value = resMgr->stringValue( section, param ); - QStringList valsOld = QStringList::split( separ, value ); - QStringList valsNew = QStringList::split( separ, newValue ); + QStringList valsOld = value.split( separ, QString::SkipEmptyParts ); + QStringList valsNew = newValue.split( separ, QString::SkipEmptyParts ); for ( int i = 0; i < (int)valsNew.count(); i++ ) if ( !valsOld.contains( valsNew[i] ) ) valsOld.append( valsNew[i] ); @@ -152,12 +151,12 @@ int main( int argc, char** argv ) } } else if ( anArg.contains( "=" ) ) { - QStringList vals = QStringList::split( "=", anArg ); + QStringList vals = anArg.split( "=", QString::SkipEmptyParts ); if ( vals[ 0 ].contains( ":" ) ) { - QStringList vals1 = QStringList::split( ":", vals[ 0 ] ); - QString section = vals1[ 0 ].stripWhiteSpace(); - QString param = vals1[ 1 ].stripWhiteSpace(); - QString value = vals [ 1 ].stripWhiteSpace(); + QStringList vals1 = vals[ 0 ].split( ":", QString::SkipEmptyParts ); + QString section = vals1[ 0 ].trimmed(); + QString param = vals1[ 1 ].trimmed(); + QString value = vals [ 1 ].trimmed(); if ( section.isEmpty() || param.isEmpty() ) continue; resMgr->setValue( section, param, value ); } diff --git a/src/src.pro b/src/src.pro index 8036e1463..74a97dac5 100644 --- a/src/src.pro +++ b/src/src.pro @@ -20,4 +20,4 @@ SUBDIRS += SVTK SUBDIRS += OCCViewer SUBDIRS += SOCC SUBDIRS += Event - +SUBDIRS += ResExporter -- 2.39.2