From 0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 30 Jun 2011 00:15:53 +0000 Subject: TQt4 port piklab This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1238822 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/common/global/generic_config.cpp | 86 ++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'src/common/global/generic_config.cpp') diff --git a/src/common/global/generic_config.cpp b/src/common/global/generic_config.cpp index 841233b..6ddf44c 100644 --- a/src/common/global/generic_config.cpp +++ b/src/common/global/generic_config.cpp @@ -11,12 +11,12 @@ #include "global.h" #if defined(NO_KDE) -# include +# include class GenericConfigPrivate { public: - GenericConfigPrivate(const QString &group) { _settings.beginGroup("/piklab/" + group); } - QSettings _settings; + GenericConfigPrivate(const TQString &group) { _settings.beginGroup("/piklab/" + group); } + TQSettings _settings; }; #else # include @@ -24,7 +24,7 @@ public: class GenericConfigPrivate { public: - GenericConfigPrivate(const QString &group) : _group(group) {} + GenericConfigPrivate(const TQString &group) : _group(group) {} ~GenericConfigPrivate() { kapp->config()->sync(); } KConfig &config() { KConfig *conf = kapp->config(); @@ -33,11 +33,11 @@ public: } private: - QString _group; + TQString _group; }; #endif -GenericConfig::GenericConfig(const QString &group) +GenericConfig::GenericConfig(const TQString &group) : _group(group) { _d = new GenericConfigPrivate(group); @@ -57,10 +57,10 @@ void GenericConfig::rollback() #endif } -QString GenericConfig::readEntry(const QString &key, const QString &def) const +TQString GenericConfig::readEntry(const TQString &key, const TQString &def) const { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 return _d->_settings.readEntry(key, def); # else return _d->_settings.value(key, def).toString(); @@ -69,10 +69,10 @@ QString GenericConfig::readEntry(const QString &key, const QString &def) const return _d->config().readEntry(key, def); #endif } -void GenericConfig::writeEntry(const QString &key, const QString &value) +void GenericConfig::writeEntry(const TQString &key, const TQString &value) { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 _d->_settings.writeEntry(key, value); # else _d->_settings.setValue(key, value); @@ -82,10 +82,10 @@ void GenericConfig::writeEntry(const QString &key, const QString &value) #endif } -QStringList GenericConfig::readListEntry(const QString &key, const QStringList &defaultValues) const +TQStringList GenericConfig::readListEntry(const TQString &key, const TQStringList &defaultValues) const { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 if ( _d->_settings.readEntry(key).isNull() ) return defaultValues; return _d->_settings.readListEntry(key); # else @@ -96,10 +96,10 @@ QStringList GenericConfig::readListEntry(const QString &key, const QStringList & return _d->config().readListEntry(key); #endif } -void GenericConfig::writeEntry(const QString &key, const QStringList &value) +void GenericConfig::writeEntry(const TQString &key, const TQStringList &value) { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 _d->_settings.writeEntry(key, value); # else _d->_settings.setValue(key, value); @@ -109,12 +109,12 @@ void GenericConfig::writeEntry(const QString &key, const QStringList &value) #endif } -QValueList GenericConfig::readIntListEntry(const QString &key) const +TQValueList GenericConfig::readIntListEntry(const TQString &key) const { #if defined(NO_KDE) - QValueList ilist; - QStringList list = readListEntry(key, QStringList()); - QStringList::const_iterator it; + TQValueList ilist; + TQStringList list = readListEntry(key, TQStringList()); + TQStringList::const_iterator it; for (it=list.begin(); it!=list.end(); ++it) { bool ok; int v = (*it).toInt(&ok); @@ -126,32 +126,32 @@ QValueList GenericConfig::readIntListEntry(const QString &key) const return _d->config().readIntListEntry(key); #endif } -void GenericConfig::writeEntry(const QString &key, const QValueList &value) +void GenericConfig::writeEntry(const TQString &key, const TQValueList &value) { #if defined(NO_KDE) - QStringList list; - QValueList::const_iterator it; - for (it=value.begin(); it!=value.end(); ++it) list.append(QString::number(*it)); + TQStringList list; + TQValueList::const_iterator it; + for (it=value.begin(); it!=value.end(); ++it) list.append(TQString::number(*it)); writeEntry(key, list); #else _d->config().writeEntry(key, value); #endif } -QSize GenericConfig::readSizeEntry(const QString &key, const QSize *def) const +TQSize GenericConfig::readSizeEntry(const TQString &key, const TQSize *def) const { #if defined(NO_KDE) - QValueList list = readIntListEntry(key); + TQValueList list = readIntListEntry(key); if ( list.count()!=2 ) return *def; - return QSize(list[0], list[1]); + return TQSize(list[0], list[1]); #else return _d->config().readSizeEntry(key, def); #endif } -void GenericConfig::writeEntry(const QString &key, const QSize &value) +void GenericConfig::writeEntry(const TQString &key, const TQSize &value) { #if defined(NO_KDE) - QValueList ilist; + TQValueList ilist; ilist.append(value.width()); ilist.append(value.height()); writeEntry(key, ilist); @@ -160,10 +160,10 @@ void GenericConfig::writeEntry(const QString &key, const QSize &value) #endif } -bool GenericConfig::readBoolEntry(const QString &key, bool def) const +bool GenericConfig::readBoolEntry(const TQString &key, bool def) const { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 return _d->_settings.readBoolEntry(key, def); # else return _d->_settings.value(key, def).toBool(); @@ -172,10 +172,10 @@ bool GenericConfig::readBoolEntry(const QString &key, bool def) const return _d->config().readBoolEntry(key, def); #endif } -void GenericConfig::writeEntry(const QString &key, bool value) +void GenericConfig::writeEntry(const TQString &key, bool value) { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 _d->_settings.writeEntry(key, value); # else _d->_settings.setValue(key, value); @@ -185,10 +185,10 @@ void GenericConfig::writeEntry(const QString &key, bool value) #endif } -int GenericConfig::readIntEntry(const QString &key, int def) const +int GenericConfig::readIntEntry(const TQString &key, int def) const { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 return _d->_settings.readNumEntry(key, def); # else return _d->_settings.value(key, def).toInt(); @@ -197,10 +197,10 @@ int GenericConfig::readIntEntry(const QString &key, int def) const return _d->config().readNumEntry(key, def); #endif } -void GenericConfig::writeEntry(const QString &key, int value) +void GenericConfig::writeEntry(const TQString &key, int value) { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 _d->_settings.writeEntry(key, value); # else _d->_settings.setValue(key, value); @@ -210,7 +210,7 @@ void GenericConfig::writeEntry(const QString &key, int value) #endif } -void GenericConfig::deleteGroup(const QString &group) +void GenericConfig::deleteGroup(const TQString &group) { #if defined(NO_KDE) Q_UNUSED(group); @@ -220,22 +220,22 @@ void GenericConfig::deleteGroup(const QString &group) #endif } -QVariant GenericConfig::readVariantEntry(const QString &key, const QVariant &defValue) const +TQVariant GenericConfig::readVariantEntry(const TQString &key, const TQVariant &defValue) const { switch (defValue.type()) { - case QVariant::Bool: return QVariant(readBoolEntry(key, defValue.toBool()), 0); - case QVariant::UInt: return readUIntEntry(key, defValue.toUInt()); + case TQVariant::Bool: return TQVariant(readBoolEntry(key, defValue.toBool()), 0); + case TQVariant::UInt: return readUIntEntry(key, defValue.toUInt()); default: break; } Q_ASSERT(false); - return QVariant(); + return TQVariant(); } -void GenericConfig::writeEntry(const QString &key, const QVariant &v) +void GenericConfig::writeEntry(const TQString &key, const TQVariant &v) { switch (v.type()) { - case QVariant::Bool: writeEntry(key, v.toBool()); break; - case QVariant::UInt: writeEntry(key, v.toUInt()); break; + case TQVariant::Bool: writeEntry(key, v.toBool()); break; + case TQVariant::UInt: writeEntry(key, v.toUInt()); break; default: Q_ASSERT(false); break; } } -- cgit v1.2.1