From 68f5e9b963de7a8b079ffb72528d69119010792f Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Tue, 16 Aug 2016 17:17:16 +0300 Subject: [PATCH] Clang-format. --- .../MWMOpeningHoursClosedSpanTableViewCell.mm | 26 ++-- .../MWMMapDownloaderPlaceTableViewCell.mm | 30 ++-- .../MWMMapDownloaderSubplaceTableViewCell.mm | 18 +-- .../Cells/MWMMapDownloaderTableViewCell.mm | 139 ++++++++---------- iphone/Maps/Classes/MapViewController.mm | 2 +- iphone/Maps/Classes/MapsAppDelegate.mm | 2 +- iphone/Maps/Classes/Routing/MWMRouter.mm | 2 +- .../Classes/Routing/MWMRouterSavedState.mm | 6 +- 8 files changed, 101 insertions(+), 124 deletions(-) diff --git a/iphone/Maps/Classes/Editor/OpeningHours/Cells/MWMOpeningHoursClosedSpanTableViewCell.mm b/iphone/Maps/Classes/Editor/OpeningHours/Cells/MWMOpeningHoursClosedSpanTableViewCell.mm index 52c967f980..8e04f5f8c4 100644 --- a/iphone/Maps/Classes/Editor/OpeningHours/Cells/MWMOpeningHoursClosedSpanTableViewCell.mm +++ b/iphone/Maps/Classes/Editor/OpeningHours/Cells/MWMOpeningHoursClosedSpanTableViewCell.mm @@ -1,6 +1,6 @@ #import "MWMOpeningHoursClosedSpanTableViewCell.h" -#import "UIFont+MapsMeFonts.h" #import "UIColor+MapsMeColor.h" +#import "UIFont+MapsMeFonts.h" static NSString * const kLabelText = L(@"editor_hours_closed"); @@ -23,24 +23,20 @@ BOOL isCompactForCellWidth(CGFloat width) @interface MWMOpeningHoursClosedSpanTableViewCell () -@property (weak, nonatomic) IBOutlet UILabel * hoursClosedLabel; -@property (weak, nonatomic) IBOutlet UILabel * timeSpanLabel; +@property(weak, nonatomic) IBOutlet UILabel * hoursClosedLabel; +@property(weak, nonatomic) IBOutlet UILabel * timeSpanLabel; -@property (weak, nonatomic) IBOutlet NSLayoutConstraint * timeSpanHorizontalAlignment; -@property (weak, nonatomic) IBOutlet NSLayoutConstraint * timeSpanVerticalAlignment; -@property (weak, nonatomic) IBOutlet NSLayoutConstraint * hoursClosedTrailing; +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * timeSpanHorizontalAlignment; +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * timeSpanVerticalAlignment; +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * hoursClosedTrailing; -@property (nonatomic) BOOL isCompact; +@property(nonatomic) BOOL isCompact; @end @implementation MWMOpeningHoursClosedSpanTableViewCell -+ (CGFloat)heightForWidth:(CGFloat)width -{ - return isCompactForCellWidth(width) ? 44.0 : 64.0; -} - ++ (CGFloat)heightForWidth:(CGFloat)width { return isCompactForCellWidth(width) ? 44.0 : 64.0; } - (void)awakeFromNib { [super awakeFromNib]; @@ -101,11 +97,7 @@ BOOL isCompactForCellWidth(CGFloat width) #pragma mark - Actions -- (IBAction)cancelTap -{ - [self.section removeClosedTime:self.row]; -} - +- (IBAction)cancelTap { [self.section removeClosedTime:self.row]; } - (IBAction)expandTap { if (!self.isVisible) diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderPlaceTableViewCell.mm b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderPlaceTableViewCell.mm index 69a584e07d..3b389aa2e3 100644 --- a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderPlaceTableViewCell.mm +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderPlaceTableViewCell.mm @@ -1,29 +1,27 @@ -#import "Common.h" #import "MWMMapDownloaderPlaceTableViewCell.h" +#import "Common.h" #import "UIFont+MapsMeFonts.h" #include "Framework.h" @interface MWMMapDownloaderTableViewCell () -- (NSAttributedString *)matchedString:(NSString *)str selectedAttrs:(NSDictionary *)selectedAttrs unselectedAttrs:(NSDictionary *)unselectedAttrs; +- (NSAttributedString *)matchedString:(NSString *)str + selectedAttrs:(NSDictionary *)selectedAttrs + unselectedAttrs:(NSDictionary *)unselectedAttrs; @end @interface MWMMapDownloaderPlaceTableViewCell () -@property (weak, nonatomic) IBOutlet UILabel * descriptionLabel; -@property (weak, nonatomic) IBOutlet NSLayoutConstraint * titleBottomOffset; +@property(weak, nonatomic) IBOutlet UILabel * descriptionLabel; +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * titleBottomOffset; @end @implementation MWMMapDownloaderPlaceTableViewCell -+ (CGFloat)estimatedHeight -{ - return 62.0; -} - ++ (CGFloat)estimatedHeight { return 62.0; } - (void)layoutSubviews { [super layoutSubviews]; @@ -40,8 +38,8 @@ { [super config:nodeAttrs]; BOOL isDescriptionVisible = NO; - NSDictionary * const selectedAreaAttrs = @{ NSFontAttributeName : [UIFont bold12] }; - NSDictionary * const unselectedAreaAttrs = @{ NSFontAttributeName : [UIFont regular12] }; + NSDictionary * const selectedAreaAttrs = @{NSFontAttributeName : [UIFont bold12]}; + NSDictionary * const unselectedAreaAttrs = @{NSFontAttributeName : [UIFont regular12]}; if (self.needDisplayArea && nodeAttrs.m_topmostParentInfo.size() == 1) { string const & areaName = nodeAttrs.m_topmostParentInfo[0].m_localName; @@ -54,12 +52,14 @@ else if (!nodeAttrs.m_nodeLocalDescription.empty()) { isDescriptionVisible = YES; - self.descriptionLabel.attributedText = [self matchedString:@(nodeAttrs.m_nodeLocalDescription.c_str()) - selectedAttrs:selectedAreaAttrs - unselectedAttrs:unselectedAreaAttrs]; + self.descriptionLabel.attributedText = + [self matchedString:@(nodeAttrs.m_nodeLocalDescription.c_str()) + selectedAttrs:selectedAreaAttrs + unselectedAttrs:unselectedAreaAttrs]; } self.descriptionLabel.hidden = !isDescriptionVisible; - self.titleBottomOffset.priority = isDescriptionVisible ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh; + self.titleBottomOffset.priority = + isDescriptionVisible ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh; } @end diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderSubplaceTableViewCell.mm b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderSubplaceTableViewCell.mm index 41ad2a8f64..063c743c7e 100644 --- a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderSubplaceTableViewCell.mm +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderSubplaceTableViewCell.mm @@ -1,26 +1,24 @@ -#import "Common.h" #import "MWMMapDownloaderSubplaceTableViewCell.h" +#import "Common.h" #import "UIFont+MapsMeFonts.h" @interface MWMMapDownloaderTableViewCell () -- (NSAttributedString *)matchedString:(NSString *)str selectedAttrs:(NSDictionary *)selectedAttrs unselectedAttrs:(NSDictionary *)unselectedAttrs; +- (NSAttributedString *)matchedString:(NSString *)str + selectedAttrs:(NSDictionary *)selectedAttrs + unselectedAttrs:(NSDictionary *)unselectedAttrs; @end @interface MWMMapDownloaderSubplaceTableViewCell () -@property (weak, nonatomic) IBOutlet UILabel * subPlace; +@property(weak, nonatomic) IBOutlet UILabel * subPlace; @end @implementation MWMMapDownloaderSubplaceTableViewCell -+ (CGFloat)estimatedHeight -{ - return 82.0; -} - ++ (CGFloat)estimatedHeight { return 82.0; } - (void)layoutSubviews { [super layoutSubviews]; @@ -33,8 +31,8 @@ - (void)setSubplaceText:(NSString *)text { - NSDictionary * const selectedSubPlaceAttrs = @{ NSFontAttributeName : [UIFont bold14] }; - NSDictionary * const unselectedSubPlaceAttrs = @{ NSFontAttributeName : [UIFont regular14] }; + NSDictionary * const selectedSubPlaceAttrs = @{NSFontAttributeName : [UIFont bold14]}; + NSDictionary * const unselectedSubPlaceAttrs = @{NSFontAttributeName : [UIFont regular14]}; self.subPlace.attributedText = [self matchedString:text selectedAttrs:selectedSubPlaceAttrs unselectedAttrs:unselectedSubPlaceAttrs]; diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm index 7dac7f1de8..12ea4e5ed2 100644 --- a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderTableViewCell.mm @@ -1,20 +1,20 @@ +#import "MWMMapDownloaderTableViewCell.h" #import "Common.h" #import "MWMCircularProgress.h" #import "MWMMapDownloaderLargeCountryTableViewCell.h" -#import "MWMMapDownloaderTableViewCell.h" #import "NSString+Categories.h" #import "UIFont+MapsMeFonts.h" #include "Framework.h" -@interface MWMMapDownloaderTableViewCell () +@interface MWMMapDownloaderTableViewCell () -@property (nonatomic) MWMCircularProgress * progress; -@property (copy, nonatomic) NSString * searchQuery; +@property(nonatomic) MWMCircularProgress * progress; +@property(copy, nonatomic) NSString * searchQuery; -@property (weak, nonatomic) IBOutlet UIView * stateWrapper; -@property (weak, nonatomic) IBOutlet UILabel * title; -@property (weak, nonatomic) IBOutlet UILabel * downloadSize; +@property(weak, nonatomic) IBOutlet UIView * stateWrapper; +@property(weak, nonatomic) IBOutlet UILabel * title; +@property(weak, nonatomic) IBOutlet UILabel * downloadSize; @end @@ -23,11 +23,7 @@ storage::TCountryId m_countryId; } -+ (CGFloat)estimatedHeight -{ - return 52.0; -} - ++ (CGFloat)estimatedHeight { return 52.0; } - (void)awakeFromNib { [super awakeFromNib]; @@ -53,7 +49,9 @@ #pragma mark - Search matching -- (NSAttributedString *)matchedString:(NSString *)str selectedAttrs:(NSDictionary *)selectedAttrs unselectedAttrs:(NSDictionary *)unselectedAttrs +- (NSAttributedString *)matchedString:(NSString *)str + selectedAttrs:(NSDictionary *)selectedAttrs + unselectedAttrs:(NSDictionary *)unselectedAttrs { NSMutableAttributedString * attrTitle = [[NSMutableAttributedString alloc] initWithString:str]; [attrTitle addAttributes:unselectedAttrs range:{0, str.length}]; @@ -70,8 +68,8 @@ { [self configProgress:nodeAttrs]; - NSDictionary * const selectedTitleAttrs = @{ NSFontAttributeName : [UIFont bold17] }; - NSDictionary * const unselectedTitleAttrs = @{ NSFontAttributeName : [UIFont regular17] }; + NSDictionary * const selectedTitleAttrs = @{NSFontAttributeName : [UIFont bold17]}; + NSDictionary * const unselectedTitleAttrs = @{NSFontAttributeName : [UIFont regular17]}; self.title.attributedText = [self matchedString:@(nodeAttrs.m_nodeLocalName.c_str()) selectedAttrs:selectedTitleAttrs unselectedAttrs:unselectedTitleAttrs]; @@ -85,49 +83,42 @@ - (void)configProgress:(storage::NodeAttrs const &)nodeAttrs { MWMCircularProgress * progress = self.progress; - MWMButtonColoring const coloring = self.mode == mwm::DownloaderMode::Downloaded - ? MWMButtonColoringBlack - : MWMButtonColoringBlue; + MWMButtonColoring const coloring = + self.mode == mwm::DownloaderMode::Downloaded ? MWMButtonColoringBlack : MWMButtonColoringBlue; switch (nodeAttrs.m_status) { - case NodeStatus::NotDownloaded: - case NodeStatus::Partly: - { - MWMCircularProgressStateVec const affectedStates = {MWMCircularProgressStateNormal, - MWMCircularProgressStateSelected}; - UIImage * image = [self isKindOfClass:[MWMMapDownloaderLargeCountryTableViewCell class]] - ? [UIImage imageNamed:@"ic_folder"] - : [UIImage imageNamed:@"ic_download"]; - [progress setImage:image forStates:affectedStates]; - [progress setColoring:coloring forStates:affectedStates]; - progress.state = MWMCircularProgressStateNormal; - break; - } - case NodeStatus::Downloading: - { - auto const & prg = nodeAttrs.m_downloadingProgress; - progress.progress = static_cast(prg.first) / prg.second; - break; - } - case NodeStatus::InQueue: - progress.state = MWMCircularProgressStateSpinner; - break; - case NodeStatus::Undefined: - case NodeStatus::Error: - progress.state = MWMCircularProgressStateFailed; - break; - case NodeStatus::OnDisk: - progress.state = MWMCircularProgressStateCompleted; - break; - case NodeStatus::OnDiskOutOfDate: - { - MWMCircularProgressStateVec const affectedStates = {MWMCircularProgressStateNormal, - MWMCircularProgressStateSelected}; - [progress setImage:[UIImage imageNamed:@"ic_update"] forStates:affectedStates]; - [progress setColoring:MWMButtonColoringOther forStates:affectedStates]; - progress.state = MWMCircularProgressStateNormal; - break; - } + case NodeStatus::NotDownloaded: + case NodeStatus::Partly: + { + MWMCircularProgressStateVec const affectedStates = {MWMCircularProgressStateNormal, + MWMCircularProgressStateSelected}; + UIImage * image = [self isKindOfClass:[MWMMapDownloaderLargeCountryTableViewCell class]] + ? [UIImage imageNamed:@"ic_folder"] + : [UIImage imageNamed:@"ic_download"]; + [progress setImage:image forStates:affectedStates]; + [progress setColoring:coloring forStates:affectedStates]; + progress.state = MWMCircularProgressStateNormal; + break; + } + case NodeStatus::Downloading: + { + auto const & prg = nodeAttrs.m_downloadingProgress; + progress.progress = static_cast(prg.first) / prg.second; + break; + } + case NodeStatus::InQueue: progress.state = MWMCircularProgressStateSpinner; break; + case NodeStatus::Undefined: + case NodeStatus::Error: progress.state = MWMCircularProgressStateFailed; break; + case NodeStatus::OnDisk: progress.state = MWMCircularProgressStateCompleted; break; + case NodeStatus::OnDiskOutOfDate: + { + MWMCircularProgressStateVec const affectedStates = {MWMCircularProgressStateNormal, + MWMCircularProgressStateSelected}; + [progress setImage:[UIImage imageNamed:@"ic_update"] forStates:affectedStates]; + [progress setColoring:MWMButtonColoringOther forStates:affectedStates]; + progress.state = MWMCircularProgressStateNormal; + break; + } } } @@ -142,7 +133,8 @@ [self config:nodeAttrs]; } -- (void)processCountry:(TCountryId const &)countryId progress:(MapFilesDownloader::TProgress const &)progress +- (void)processCountry:(TCountryId const &)countryId + progress:(MapFilesDownloader::TProgress const &)progress { if (countryId != m_countryId) return; @@ -157,26 +149,19 @@ GetFramework().Storage().GetNodeAttrs(m_countryId, nodeAttrs); switch (nodeAttrs.m_status) { - case NodeStatus::NotDownloaded: - case NodeStatus::Partly: - if ([self isKindOfClass:[MWMMapDownloaderLargeCountryTableViewCell class]]) - [self.delegate openNodeSubtree:m_countryId]; - else - [self.delegate downloadNode:m_countryId]; - break; - case NodeStatus::Undefined: - case NodeStatus::Error: - [self.delegate retryDownloadNode:m_countryId]; - break; - case NodeStatus::OnDiskOutOfDate: - [self.delegate updateNode:m_countryId]; - break; - case NodeStatus::Downloading: - case NodeStatus::InQueue: - [self.delegate cancelNode:m_countryId]; - break; - case NodeStatus::OnDisk: - break; + case NodeStatus::NotDownloaded: + case NodeStatus::Partly: + if ([self isKindOfClass:[MWMMapDownloaderLargeCountryTableViewCell class]]) + [self.delegate openNodeSubtree:m_countryId]; + else + [self.delegate downloadNode:m_countryId]; + break; + case NodeStatus::Undefined: + case NodeStatus::Error: [self.delegate retryDownloadNode:m_countryId]; break; + case NodeStatus::OnDiskOutOfDate: [self.delegate updateNode:m_countryId]; break; + case NodeStatus::Downloading: + case NodeStatus::InQueue: [self.delegate cancelNode:m_countryId]; break; + case NodeStatus::OnDisk: break; } } diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index b969472835..b92235ffbf 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -22,11 +22,11 @@ #import "MWMPageController.h" #import "MWMPlacePageEntity.h" #import "MWMRouter.h" +#import "MWMRouterSavedState.h" #import "MWMStorage.h" #import "MWMTableViewController.h" #import "MWMWhatsNewNavigationController.h" #import "MapsAppDelegate.h" -#import "MWMRouterSavedState.h" #import "Statistics.h" #import "UIColor+MapsMeColor.h" #import "UIFont+MapsMeFonts.h" diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index ddc9f60582..bdf7ad34bb 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -13,11 +13,11 @@ #import "MWMFrameworkObservers.h" #import "MWMLocationManager.h" #import "MWMRouter.h" +#import "MWMRouterSavedState.h" #import "MWMStorage.h" #import "MWMTextToSpeech.h" #import "MapViewController.h" #import "Preferences.h" -#import "MWMRouterSavedState.h" #import "Statistics.h" #import "UIColor+MapsMeColor.h" #import "UIFont+MapsMeFonts.h" diff --git a/iphone/Maps/Classes/Routing/MWMRouter.mm b/iphone/Maps/Classes/Routing/MWMRouter.mm index 7baa26fc04..501014ccff 100644 --- a/iphone/Maps/Classes/Routing/MWMRouter.mm +++ b/iphone/Maps/Classes/Routing/MWMRouter.mm @@ -6,12 +6,12 @@ #import "MWMLocationManager.h" #import "MWMMapViewControlsManager.h" #import "MWMNavigationDashboardManager.h" +#import "MWMRouterSavedState.h" #import "MWMSearch.h" #import "MWMStorage.h" #import "MWMTextToSpeech.h" #import "MapViewController.h" #import "MapsAppDelegate.h" -#import "MWMRouterSavedState.h" #import "Statistics.h" #include "Framework.h" diff --git a/iphone/Maps/Classes/Routing/MWMRouterSavedState.mm b/iphone/Maps/Classes/Routing/MWMRouterSavedState.mm index 61d2488126..15d0138ced 100644 --- a/iphone/Maps/Classes/Routing/MWMRouterSavedState.mm +++ b/iphone/Maps/Classes/Routing/MWMRouterSavedState.mm @@ -24,7 +24,8 @@ static NSString * const kETAKey = @"eta"; if (self) { _forceStateChange = MWMRouterForceStateChange::None; - NSDictionary * const stateDict = [NSDictionary dictionaryWithContentsOfURL:[MWMRouterSavedState stateFileURL]]; + NSDictionary * const stateDict = + [NSDictionary dictionaryWithContentsOfURL:[MWMRouterSavedState stateFileURL]]; if (stateDict) { m2::PointD point; @@ -67,7 +68,8 @@ static NSString * const kETAKey = @"eta"; + (NSURL *)stateFileURL { - return [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"route_info.ini"]]; + return [NSURL + fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"route_info.ini"]]; } + (void)restore