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/printsupport/dialogs/qprintdialog_mac.mm | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/printsupport/dialogs/qprintdialog_mac.mm') diff --git a/src/printsupport/dialogs/qprintdialog_mac.mm b/src/printsupport/dialogs/qprintdialog_mac.mm index 854779977c..ed2d0908c4 100644 --- a/src/printsupport/dialogs/qprintdialog_mac.mm +++ b/src/printsupport/dialogs/qprintdialog_mac.mm @@ -77,22 +77,20 @@ QT_USE_NAMESPACE @class QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate); @interface QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) : NSObject -{ +@end + +@implementation QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) { NSPrintInfo *printInfo; } -- (id)initWithNSPrintInfo:(NSPrintInfo *)nsPrintInfo; -- (void)printPanelDidEnd:(NSPrintPanel *)printPanel - returnCode:(int)returnCode contextInfo:(void *)contextInfo; -@end -@implementation QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) -- (id)initWithNSPrintInfo:(NSPrintInfo *)nsPrintInfo +- (instancetype)initWithNSPrintInfo:(NSPrintInfo *)nsPrintInfo { - if (self = [super init]) { + if ((self = [self init])) { printInfo = nsPrintInfo; } return self; } + - (void)printPanelDidEnd:(NSPrintPanel *)printPanel returnCode:(int)returnCode contextInfo:(void *)contextInfo { @@ -102,8 +100,8 @@ QT_USE_NAMESPACE QPrinter *printer = dialog->printer(); if (returnCode == NSModalResponseOK) { - PMPrintSession session = static_cast([printInfo PMPrintSession]); - PMPrintSettings settings = static_cast([printInfo PMPrintSettings]); + PMPrintSession session = static_cast(printInfo.PMPrintSession); + PMPrintSettings settings = static_cast(printInfo.PMPrintSettings); UInt32 frompage, topage; PMGetFirstPage(settings, &frompage); @@ -192,6 +190,7 @@ QT_USE_NAMESPACE dialog->done((returnCode == NSModalResponseOK) ? QDialog::Accepted : QDialog::Rejected); } + @end QT_BEGIN_NAMESPACE -- cgit v1.2.3