summaryrefslogtreecommitdiffstats
path: root/src/printsupport
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2018-02-01 10:32:07 -0800
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-02-20 10:02:12 +0000
commitba871065e0f40e9197fa4ee0ffe76530bb6fca11 (patch)
treed4361d26260ef3bd96d9f89450893b7c9e99fbeb /src/printsupport
parent34017a8c5aaca2723fb62e79ea177b5579040ad3 (diff)
Clean up our Objective-C usage
- 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 <jake.petroules@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/printsupport')
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_mac.mm11
-rw-r--r--src/printsupport/dialogs/qprintdialog_mac.mm19
2 files changed, 13 insertions, 17 deletions
diff --git a/src/printsupport/dialogs/qpagesetupdialog_mac.mm b/src/printsupport/dialogs/qpagesetupdialog_mac.mm
index 1e398452f7..a3511fe7b6 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_mac.mm
+++ b/src/printsupport/dialogs/qpagesetupdialog_mac.mm
@@ -52,16 +52,13 @@ QT_USE_NAMESPACE
@class QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate);
@interface QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) : NSObject
-{
+@end
+
+@implementation QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) {
NSPrintInfo *printInfo;
}
-- (id)initWithNSPrintInfo:(NSPrintInfo *)nsPrintInfo;
-- (void)pageLayoutDidEnd:(NSPageLayout *)pageLayout
- returnCode:(int)returnCode contextInfo:(void *)contextInfo;
-@end
-@implementation QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate)
-- (id)initWithNSPrintInfo:(NSPrintInfo *)nsPrintInfo
+- (instancetype)initWithNSPrintInfo:(NSPrintInfo *)nsPrintInfo
{
self = [super init];
if (self) {
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<PMPrintSession>([printInfo PMPrintSession]);
- PMPrintSettings settings = static_cast<PMPrintSettings>([printInfo PMPrintSettings]);
+ PMPrintSession session = static_cast<PMPrintSession>(printInfo.PMPrintSession);
+ PMPrintSettings settings = static_cast<PMPrintSettings>(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