QMacTimeZonePrivate: use .member rather than [- member] notation
Apparently this is our preferred style for Objective C member references. Change-Id: I8b2bbaabadbea2cfa74f209372e77cee79e3c895 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
deb166a5ff
commit
dc7fa56948
@ -111,7 +111,7 @@ void QMacTimeZonePrivate::init(const QByteArray &ianaId)
|
|||||||
|
|
||||||
QString QMacTimeZonePrivate::comment() const
|
QString QMacTimeZonePrivate::comment() const
|
||||||
{
|
{
|
||||||
return QString::fromNSString([m_nstz description]);
|
return QString::fromNSString(m_nstz.description);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
|
QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
|
||||||
@ -214,7 +214,7 @@ bool QMacTimeZonePrivate::hasTransitions() const
|
|||||||
// TODO Not sure what is returned in event of no transitions, assume will be before requested date
|
// TODO Not sure what is returned in event of no transitions, assume will be before requested date
|
||||||
NSDate *epoch = [NSDate dateWithTimeIntervalSince1970:0];
|
NSDate *epoch = [NSDate dateWithTimeIntervalSince1970:0];
|
||||||
const NSDate *date = [m_nstz nextDaylightSavingTimeTransitionAfterDate:epoch];
|
const NSDate *date = [m_nstz nextDaylightSavingTimeTransitionAfterDate:epoch];
|
||||||
const bool result = ([date timeIntervalSince1970] > [epoch timeIntervalSince1970]);
|
const bool result = (date.timeIntervalSince1970 > epoch.timeIntervalSince1970);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::nextTransition(qint64 afterMSecsSinc
|
|||||||
const NSTimeInterval seconds = afterMSecsSinceEpoch / 1000.0;
|
const NSTimeInterval seconds = afterMSecsSinceEpoch / 1000.0;
|
||||||
NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:seconds];
|
NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:seconds];
|
||||||
nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
|
nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
|
||||||
const NSTimeInterval nextSecs = [nextDate timeIntervalSince1970];
|
const NSTimeInterval nextSecs = nextDate.timeIntervalSince1970;
|
||||||
if (nextDate == nil || nextSecs <= seconds) {
|
if (nextDate == nil || nextSecs <= seconds) {
|
||||||
[nextDate release];
|
[nextDate release];
|
||||||
return invalidData();
|
return invalidData();
|
||||||
@ -250,7 +250,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec
|
|||||||
NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:nextSecs];
|
NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:nextSecs];
|
||||||
nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
|
nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
|
||||||
if (nextDate != nil
|
if (nextDate != nil
|
||||||
&& (tranSecs = [nextDate timeIntervalSince1970]) < endSecs) {
|
&& (tranSecs = nextDate.timeIntervalSince1970) < endSecs) {
|
||||||
// There's a transition within the last year before endSecs:
|
// There's a transition within the last year before endSecs:
|
||||||
nextSecs = tranSecs;
|
nextSecs = tranSecs;
|
||||||
} else {
|
} else {
|
||||||
@ -259,7 +259,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec
|
|||||||
nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
|
nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
|
||||||
if (nextDate != nil) {
|
if (nextDate != nil) {
|
||||||
NSTimeInterval lateSecs = nextSecs;
|
NSTimeInterval lateSecs = nextSecs;
|
||||||
nextSecs = [nextDate timeIntervalSince1970];
|
nextSecs = nextDate.timeIntervalSince1970;
|
||||||
Q_ASSERT(nextSecs <= endSecs - year || nextSecs == tranSecs);
|
Q_ASSERT(nextSecs <= endSecs - year || nextSecs == tranSecs);
|
||||||
/*
|
/*
|
||||||
We're looking at the first ever transition for our zone, at
|
We're looking at the first ever transition for our zone, at
|
||||||
@ -285,8 +285,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec
|
|||||||
NSTimeInterval middle = nextSecs / 2 + lateSecs / 2;
|
NSTimeInterval middle = nextSecs / 2 + lateSecs / 2;
|
||||||
NSDate *split = [NSDate dateWithTimeIntervalSince1970:middle];
|
NSDate *split = [NSDate dateWithTimeIntervalSince1970:middle];
|
||||||
split = [m_nstz nextDaylightSavingTimeTransitionAfterDate:split];
|
split = [m_nstz nextDaylightSavingTimeTransitionAfterDate:split];
|
||||||
if (split != nil
|
if (split != nil && (tranSecs = split.timeIntervalSince1970) < endSecs) {
|
||||||
&& (tranSecs = [split timeIntervalSince1970]) < endSecs) {
|
|
||||||
nextDate = split;
|
nextDate = split;
|
||||||
nextSecs = tranSecs;
|
nextSecs = tranSecs;
|
||||||
} else {
|
} else {
|
||||||
@ -303,7 +302,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec
|
|||||||
while (nextDate != nil && nextSecs < endSecs) {
|
while (nextDate != nil && nextSecs < endSecs) {
|
||||||
prevSecs = nextSecs;
|
prevSecs = nextSecs;
|
||||||
nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
|
nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
|
||||||
nextSecs = [nextDate timeIntervalSince1970];
|
nextSecs = nextDate.timeIntervalSince1970;
|
||||||
if (nextSecs <= prevSecs) // presumably no later data available
|
if (nextSecs <= prevSecs) // presumably no later data available
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -319,18 +318,18 @@ QByteArray QMacTimeZonePrivate::systemTimeZoneId() const
|
|||||||
// Reset the cached system tz then return the name
|
// Reset the cached system tz then return the name
|
||||||
[NSTimeZone resetSystemTimeZone];
|
[NSTimeZone resetSystemTimeZone];
|
||||||
Q_ASSERT(NSTimeZone.systemTimeZone);
|
Q_ASSERT(NSTimeZone.systemTimeZone);
|
||||||
return QString::fromNSString([[NSTimeZone systemTimeZone] name]).toUtf8();
|
return QString::fromNSString(NSTimeZone.systemTimeZone.name).toUtf8();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QByteArray> QMacTimeZonePrivate::availableTimeZoneIds() const
|
QList<QByteArray> QMacTimeZonePrivate::availableTimeZoneIds() const
|
||||||
{
|
{
|
||||||
NSEnumerator *enumerator = [[NSTimeZone knownTimeZoneNames] objectEnumerator];
|
NSEnumerator *enumerator = NSTimeZone.knownTimeZoneNames.objectEnumerator;
|
||||||
QByteArray tzid = QString::fromNSString([enumerator nextObject]).toUtf8();
|
QByteArray tzid = QString::fromNSString(enumerator.nextObject).toUtf8();
|
||||||
|
|
||||||
QList<QByteArray> list;
|
QList<QByteArray> list;
|
||||||
while (!tzid.isEmpty()) {
|
while (!tzid.isEmpty()) {
|
||||||
list << tzid;
|
list << tzid;
|
||||||
tzid = QString::fromNSString([enumerator nextObject]).toUtf8();
|
tzid = QString::fromNSString(enumerator.nextObject).toUtf8();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(list.begin(), list.end());
|
std::sort(list.begin(), list.end());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user