summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qtimezoneprivate_mac.mm
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-10-03 19:34:21 +0200
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2016-10-06 08:02:59 +0000
commit669add92d9adc15ecfa0b2d62dd90ea9066d401e (patch)
tree49ad8ef5a042c1f0cf9aa305bb8836b63e1d282f /src/corelib/tools/qtimezoneprivate_mac.mm
parent1b567854e4787ac591f8039c88e8cd8a44edaef7 (diff)
Replace QCFString::to(CF/NS/Q)String usage with QString methods
Slims down QCFString and leaves only one implementation of converting back and forth between CF/NS strings and QStrings. Change-Id: I068568ffa25e6f4f6d6c99dcf47078b7a8e70e10 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/corelib/tools/qtimezoneprivate_mac.mm')
-rw-r--r--src/corelib/tools/qtimezoneprivate_mac.mm20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/corelib/tools/qtimezoneprivate_mac.mm b/src/corelib/tools/qtimezoneprivate_mac.mm
index 77c04ac20c..5dfffeaf36 100644
--- a/src/corelib/tools/qtimezoneprivate_mac.mm
+++ b/src/corelib/tools/qtimezoneprivate_mac.mm
@@ -90,7 +90,7 @@ QTimeZonePrivate *QMacTimeZonePrivate::clone()
void QMacTimeZonePrivate::init(const QByteArray &ianaId)
{
if (availableTimeZoneIds().contains(ianaId)) {
- m_nstz = [[NSTimeZone timeZoneWithName:QCFString::toNSString(QString::fromUtf8(ianaId))] retain];
+ m_nstz = [[NSTimeZone timeZoneWithName:QString::fromUtf8(ianaId).toNSString()] retain];
if (m_nstz)
m_id = ianaId;
}
@@ -98,7 +98,7 @@ void QMacTimeZonePrivate::init(const QByteArray &ianaId)
QString QMacTimeZonePrivate::comment() const
{
- return QCFString::toQString([m_nstz description]);
+ return QString::fromNSString([m_nstz description]);
}
QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
@@ -140,9 +140,9 @@ QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
break;
}
- NSString *macLocaleCode = QCFString::toNSString(locale.name());
+ NSString *macLocaleCode = locale.name().toNSString();
NSLocale *macLocale = [[NSLocale alloc] initWithLocaleIdentifier:macLocaleCode];
- const QString result = QCFString::toQString([m_nstz localizedName:style locale:macLocale]);
+ const QString result = QString::fromNSString([m_nstz localizedName:style locale:macLocale]);
[macLocale release];
return result;
}
@@ -150,7 +150,7 @@ QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
QString QMacTimeZonePrivate::abbreviation(qint64 atMSecsSinceEpoch) const
{
const NSTimeInterval seconds = atMSecsSinceEpoch / 1000.0;
- return QCFString::toQString([m_nstz abbreviationForDate:[NSDate dateWithTimeIntervalSince1970:seconds]]);
+ return QString::fromNSString([m_nstz abbreviationForDate:[NSDate dateWithTimeIntervalSince1970:seconds]]);
}
int QMacTimeZonePrivate::offsetFromUtc(qint64 atMSecsSinceEpoch) const
@@ -191,7 +191,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::data(qint64 forMSecsSinceEpoch) cons
data.offsetFromUtc = [m_nstz secondsFromGMTForDate:date];
data.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:date];
data.standardTimeOffset = data.offsetFromUtc - data.daylightTimeOffset;
- data.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:date]);
+ data.abbreviation = QString::fromNSString([m_nstz abbreviationForDate:date]);
return data;
}
@@ -220,7 +220,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::nextTransition(qint64 afterMSecsSinc
tran.offsetFromUtc = [m_nstz secondsFromGMTForDate:nextDate];
tran.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:nextDate];
tran.standardTimeOffset = tran.offsetFromUtc - tran.daylightTimeOffset;
- tran.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:nextDate]);
+ tran.abbreviation = QString::fromNSString([m_nstz abbreviationForDate:nextDate]);
return tran;
}
@@ -253,18 +253,18 @@ QByteArray QMacTimeZonePrivate::systemTimeZoneId() const
{
// Reset the cached system tz then return the name
[NSTimeZone resetSystemTimeZone];
- return QCFString::toQString([[NSTimeZone systemTimeZone] name]).toUtf8();
+ return QString::fromNSString([[NSTimeZone systemTimeZone] name]).toUtf8();
}
QList<QByteArray> QMacTimeZonePrivate::availableTimeZoneIds() const
{
NSEnumerator *enumerator = [[NSTimeZone knownTimeZoneNames] objectEnumerator];
- QByteArray tzid = QCFString::toQString([enumerator nextObject]).toUtf8();
+ QByteArray tzid = QString::fromNSString([enumerator nextObject]).toUtf8();
QList<QByteArray> list;
while (!tzid.isEmpty()) {
list << tzid;
- tzid = QCFString::toQString([enumerator nextObject]).toUtf8();
+ tzid = QString::fromNSString([enumerator nextObject]).toUtf8();
}
std::sort(list.begin(), list.end());