From ba871065e0f40e9197fa4ee0ffe76530bb6fca11 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Thu, 1 Feb 2018 10:32:07 -0800 Subject: Clean up our Objective-C usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move ivars into @implementation - Use instancetype where applicable - Use dot notation for property access - Use subscript operator for dictionaries and arrays - Format selectors consistently - Use proper style for init methods - Use generics instead of void pointers where possible - Use "range for" loops instead of indexing - Replace or replace IBAction/IBOutlet with void Change-Id: I1667812a51d4dfe44ae80fe337cb1f4bc9699d92 Reviewed-by: Jake Petroules Reviewed-by: Tor Arne Vestbø --- src/plugins/bearer/corewlan/qcorewlanengine.mm | 38 ++++++++++++-------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'src/plugins/bearer') diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 341d3bccf2..c3dd49ff3e 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -62,33 +62,29 @@ extern "C" { // Otherwise it won't find CWKeychain* symbols at link time #include @interface QT_MANGLE_NAMESPACE(QNSListener) : NSObject -{ - NSNotificationCenter *notificationCenter; - CWWiFiClient *client; - QCoreWlanEngine *engine; - NSLock *locker; -} -- (void)powerStateDidChangeForWiFiInterfaceWithName:(NSString *)interfaceName; -- (void)remove; -- (void)setEngine:(QCoreWlanEngine *)coreEngine; -- (QCoreWlanEngine *)engine; -- (void)dealloc; @property (assign) QCoreWlanEngine* engine; @end -@implementation QT_MANGLE_NAMESPACE(QNSListener) +@implementation QT_MANGLE_NAMESPACE(QNSListener) { + NSNotificationCenter *notificationCenter; + CWWiFiClient *client; + QCoreWlanEngine *engine; + NSLock *locker; +} -- (id) init +- (instancetype)init { - [locker lock]; - QMacAutoReleasePool pool; - notificationCenter = [NSNotificationCenter defaultCenter]; - client = [CWWiFiClient sharedWiFiClient]; - client.delegate = self; - [client startMonitoringEventWithType:CWEventTypePowerDidChange error:nil]; - [locker unlock]; + if ((self = [super init])) { + [locker lock]; + QMacAutoReleasePool pool; + notificationCenter = [NSNotificationCenter defaultCenter]; + client = [CWWiFiClient sharedWiFiClient]; + client.delegate = self; + [client startMonitoringEventWithType:CWEventTypePowerDidChange error:nil]; + [locker unlock]; + } return self; } @@ -300,7 +296,7 @@ void QScanThread::getUserConfigurations() if(airportPlist != nil) { NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"]; - NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"]; + NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"]; for (NSString *ssidkey in thisSsidarray) { QString thisSsid = QString::fromNSString(ssidkey); if(!userProfiles.contains(thisSsid)) { -- cgit v1.2.3