Remove trailing whitespaces.

This commit is contained in:
Yury Melnichek 2011-03-15 12:46:57 +01:00 committed by Alex Zolotarev
parent 39e1e1ea97
commit a98c3ead64
23 changed files with 171 additions and 171 deletions

View file

@ -34,20 +34,20 @@ namespace yg
// The view content is basically an EAGL surface you render your OpenGL scene into.
// Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
@interface EAGLView : UIView
{
@private
{
@private
// The pixel dimensions of the backbuffer
shared_ptr<iphone::RenderContext> renderContext;
shared_ptr<iphone::RenderBuffer> renderBuffer;
shared_ptr<yg::gl::FrameBuffer> frameBuffer;
shared_ptr<DrawerYG> drawer;
@public
shared_ptr<iphone::WindowHandle> windowHandle;
shared_ptr<yg::ResourceManager> textureManager;
MapViewController * controller;
}
@ -60,6 +60,6 @@ namespace yg
@property (nonatomic, assign) MapViewController * controller;
@property (nonatomic, assign) shared_ptr<iphone::WindowHandle> windowHandle;
@property (nonatomic, assign) shared_ptr<iphone::RenderContext> renderContext;
@property (nonatomic, assign) shared_ptr<yg::ResourceManager> resourceManager;
@property (nonatomic, assign) shared_ptr<yg::ResourceManager> resourceManager;
@end

View file

@ -38,9 +38,9 @@
{
// Setup Layer Properties
CAEAGLLayer * eaglLayer = (CAEAGLLayer *)self.layer;
eaglLayer.opaque = YES;
/// ColorFormat : RGB565
/// Backbuffer : YES, (to prevent from loosing content when mixing with ordinary layers).
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
@ -49,12 +49,12 @@
kEAGLColorFormatRGB565,
kEAGLDrawablePropertyColorFormat,
nil];
int etalonW = 320;
int scrW = etalonW;
UIDevice * device = [UIDevice currentDevice];
float ver = [device.systemVersion floatValue];
NSLog(@"%@", device.systemVersion);
/// rounding problems
@ -65,7 +65,7 @@
if (scrW == 640)
self.contentScaleFactor = 2.0;
}
renderContext = shared_ptr<iphone::RenderContext>(new iphone::RenderContext());
if (!renderContext.get())
@ -73,49 +73,49 @@
[self release];
return nil;
}
renderContext->makeCurrent();
frameBuffer = shared_ptr<yg::gl::FrameBuffer>(new yg::gl::FrameBuffer());
frameBuffer = shared_ptr<yg::gl::FrameBuffer>(new yg::gl::FrameBuffer());
int bigVBSize = pow(2, ceil(log2(15000 * sizeof(yg::gl::Vertex))));
int bigIBSize = pow(2, ceil(log2(30000 * sizeof(unsigned short))));
int smallVBSize = pow(2, ceil(log2(1500 * sizeof(yg::gl::Vertex))));
int smallIBSize = pow(2, ceil(log2(3000 * sizeof(unsigned short))));
int blitVBSize = pow(2, ceil(log2(10 * sizeof(yg::gl::AuxVertex))));
int smallIBSize = pow(2, ceil(log2(3000 * sizeof(unsigned short))));
int blitVBSize = pow(2, ceil(log2(10 * sizeof(yg::gl::AuxVertex))));
int blitIBSize = pow(2, ceil(log2(10 * sizeof(unsigned short))));
resourceManager = shared_ptr<yg::ResourceManager>(new yg::ResourceManager(
bigVBSize, bigIBSize, 20,
smallVBSize, smallIBSize, 30,
blitVBSize, blitIBSize, 20,
blitVBSize, blitIBSize, 20,
512, 256, 10,
GetPlatform().ReadPathForFile("unicode_blocks.txt").c_str(),
GetPlatform().ReadPathForFile("unicode_blocks.txt").c_str(),
GetPlatform().ReadPathForFile("fonts_whitelist.txt").c_str(),
GetPlatform().ReadPathForFile("fonts_blacklist.txt").c_str(),
2000000));
resourceManager->addFonts(GetPlatform().GetFontNames());
DrawerYG::params_t p;
p.m_resourceManager = resourceManager;
p.m_isMultiSampled = false;
p.m_frameBuffer = frameBuffer;
drawer = shared_ptr<DrawerYG>(new DrawerYG(GetPlatform().SkinName(), p));
// frameBuffer->onSize(renderBuffer->width(), renderBuffer->height());
// frameBuffer->setRenderTarget(renderBuffer);
// frameBuffer->setRenderTarget(renderBuffer);
windowHandle = shared_ptr<iphone::WindowHandle>(new iphone::WindowHandle(self));
windowHandle->setDrawer(drawer);
windowHandle->setRenderContext(renderContext);
}
self.multipleTouchEnabled = YES;
return self;
}
@ -124,7 +124,7 @@
/// free old video memory
frameBuffer->resetRenderTarget();
renderBuffer.reset();
/// allocate the new one
renderBuffer = shared_ptr<iphone::RenderBuffer>(new iphone::RenderBuffer(renderContext, (CAEAGLLayer*)self.layer));
frameBuffer->setRenderTarget(renderBuffer);
@ -145,17 +145,17 @@
- (void)drawViewOnMainThread
{
[self performSelectorOnMainThread:@selector(drawViewThunk:) withObject:nil waitUntilDone:NO];
[self performSelectorOnMainThread:@selector(drawViewThunk:) withObject:nil waitUntilDone:NO];
}
- (void)layoutSubviews
{
NSLog(@"layoutSubviews");
CGFloat scaleFactor = 1.0;
if ([self respondsToSelector:@selector(contentScaleFactor)])
scaleFactor = self.contentScaleFactor;
[[self controller] onResize:self.frame.size.width * scaleFactor withHeight:self.frame.size.height * scaleFactor];
[self onSize:self.frame.size.width * scaleFactor withHeight:self.frame.size.height * scaleFactor];
[self drawView];

View file

@ -13,26 +13,26 @@
@interface MapViewController : UIViewController<UserLocationControllerDelegate>
{
UserLocationController * m_locationController;
enum Action
{
NOTHING,
DRAGGING,
SCALING
} m_CurrentAction;
} m_CurrentAction;
bool m_isDirtyPosition;
bool m_isSticking;
size_t m_StickyThreshold;
m2::PointD m_Pt1, m_Pt2;
}
- (id) initWithCoder: (NSCoder *)coder;
- (void) OnLocation: (m2::PointD const &) mercatorPoint
- (void) OnLocation: (m2::PointD const &) mercatorPoint
withConfidenceRadius: (double) confidenceRadius
withTimestamp: (NSDate *) timestamp;
withTimestamp: (NSDate *) timestamp;
- (void) OnHeading: (CLHeading*) heading;
- (void) OnLocationError: (NSString *) errorDescription;

View file

@ -16,7 +16,7 @@ typedef FrameWork<model::FeaturesFetcher, Navigator, iphone::WindowHandle> frame
framework_t * m_framework = NULL;
storage::Storage m_storage;
- (void) OnMyPositionClicked: (id)sender
{
if (m_locationController.active)
@ -29,7 +29,7 @@ typedef FrameWork<model::FeaturesFetcher, Navigator, iphone::WindowHandle> frame
{
[m_locationController Start];
m_isDirtyPosition = true;
((UIBarItem *)sender).title = @"Disable GPS";
((UIBarItem *)sender).title = @"Disable GPS";
}
}
@ -56,31 +56,31 @@ typedef FrameWork<model::FeaturesFetcher, Navigator, iphone::WindowHandle> frame
if ((self = [super initWithCoder:coder]))
{
[(EAGLView*)self.view setController : self];
shared_ptr<iphone::WindowHandle> windowHandle = [(EAGLView*)self.view windowHandle];
shared_ptr<yg::ResourceManager> resourceManager = [(EAGLView*)self.view resourceManager];
m_framework = new framework_t(windowHandle, 40);
m_framework->Init(m_storage);
m_StickyThreshold = 10;
m_locationController = [[UserLocationController alloc] initWithDelegate:self];
m_CurrentAction = NOTHING;
m_isDirtyPosition = false;
// initialize with currently active screen orientation
[self didRotateFromInterfaceOrientation: self.interfaceOrientation];
m_framework->initializeGL([(EAGLView*)self.view renderContext], resourceManager);
m_framework->initializeGL([(EAGLView*)self.view renderContext], resourceManager);
// to perform a proper resize
[(EAGLView*)self.view layoutSubviews];
// restore previous screen position
if (!m_framework->LoadState())
m_framework->ShowAll();
}
return self;
}
@ -89,12 +89,12 @@ typedef FrameWork<model::FeaturesFetcher, Navigator, iphone::WindowHandle> frame
m_framework->SetHeading(newHeading.trueHeading, newHeading.magneticHeading, newHeading.headingAccuracy);
}
- (void) OnLocation: (m2::PointD const &) mercatorPoint
- (void) OnLocation: (m2::PointD const &) mercatorPoint
withConfidenceRadius: (double) confidenceRadius
withTimestamp: (NSDate *) timestamp
{
m_framework->SetPosition(mercatorPoint, confidenceRadius);
if (m_isDirtyPosition)
{
m_framework->CenterViewport();
@ -108,7 +108,7 @@ typedef FrameWork<model::FeaturesFetcher, Navigator, iphone::WindowHandle> frame
}
- (void)onResize:(GLint) width withHeight:(GLint) height
{
{
UIInterfaceOrientation orientation = [self interfaceOrientation];
if ((orientation == UIInterfaceOrientationLandscapeLeft)
||(orientation == UIInterfaceOrientationLandscapeRight))
@ -126,11 +126,11 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
{
NSSet * allTouches = [event allTouches];
int touchCount = [allTouches count];
CGFloat scaleFactor = 1.0;
if ([self.view respondsToSelector:@selector(contentScaleFactor)])
scaleFactor = self.view.contentScaleFactor;
if (touchCount == 1)
{
CGPoint pt = [[[allTouches allObjects] objectAtIndex:0] locationInView:nil];
@ -141,7 +141,7 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
NSArray * sortedTouches = [[allTouches allObjects] sortedArrayUsingFunction:compareAddress context:NULL];
CGPoint pt1 = [[sortedTouches objectAtIndex:0] locationInView:nil];
CGPoint pt2 = [[sortedTouches objectAtIndex:1] locationInView:nil];
m_Pt1 = m2::PointD(pt1.x * scaleFactor, pt1.y * scaleFactor);
m_Pt2 = m2::PointD(pt2.x * scaleFactor, pt2.y * scaleFactor);
}
@ -178,7 +178,7 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
m_framework->StartScale(ScaleEvent(m_Pt1.x, m_Pt1.y, m_Pt2.x, m_Pt2.y));
m_CurrentAction = SCALING;
}
m_isSticking = true;
}
@ -186,9 +186,9 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
{
m2::PointD TempPt1 = m_Pt1;
m2::PointD TempPt2 = m_Pt2;
[self updatePointsFromEvent:event];
bool needRedraw = false;
if (m_isSticking)
@ -203,7 +203,7 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
return;
}
}
switch (m_CurrentAction)
{
case DRAGGING:
@ -228,7 +228,7 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
{
[self updatePointsFromEvent:event];
[self stopCurrentAction];
if ((((UITouch*)[touches anyObject]).tapCount == 2) && ([[event allTouches] count] < 2))
m_framework->ScaleToPoint(ScaleToPointEvent(m_Pt1.x, m_Pt1.y, 2));
}
@ -237,7 +237,7 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
{
[self updatePointsFromEvent:event];
[self stopCurrentAction];
if ((((UITouch*)[touches anyObject]).tapCount == 2) && ([[event allTouches] count] < 2))
m_framework->ScaleToPoint(ScaleToPointEvent(m_Pt1.x, m_Pt1.y, 2));
}
@ -273,10 +273,10 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
m_framework->MemoryWarning();
// m_framework->Repaint();
// Release any cached data, images, etc that aren't in use.
}
@ -312,7 +312,7 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
m_framework->Invalidate();
}
}
- (void) OnEnterBackground
{
if (m_framework)

View file

@ -6,7 +6,7 @@
@synthesize window;
@synthesize mapViewController;
// here we're
// here we're
- (void) applicationWillTerminate: (UIApplication *) application
{
[mapViewController OnTerminate];

View file

@ -18,26 +18,26 @@ namespace iphone
class RenderBuffer : public yg::gl::RenderTarget
{
private:
unsigned int m_id;
shared_ptr<RenderContext> m_renderContext;
int m_width;
int m_height;
public:
RenderBuffer(shared_ptr<RenderContext> renderContext, CAEAGLLayer * layer);
~RenderBuffer();
void makeCurrent();
unsigned int id();
void present();
unsigned width() const;
unsigned height() const;
void attachToFrameBuffer();
};
}

View file

@ -17,44 +17,44 @@ namespace iphone
{
OGLCHECK(glGenRenderbuffersOES(1, &m_id));
makeCurrent();
[m_renderContext->getEAGLContext() renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:layer];
OGLCHECK(glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &m_width));
OGLCHECK(glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &m_height));
}
void RenderBuffer::makeCurrent()
{
OGLCHECK(glBindRenderbufferOES(GL_RENDERBUFFER_OES, m_id));
}
RenderBuffer::~RenderBuffer()
{
OGLCHECK(glDeleteRenderbuffersOES(1, &m_id));
}
unsigned int RenderBuffer::id()
{
return m_id;
}
void RenderBuffer::present()
{
makeCurrent();
int tryCount = 0;
while (!([m_renderContext->getEAGLContext() presentRenderbuffer:GL_RENDERBUFFER_OES])
&& (tryCount++ < 100));
if (tryCount != 0)
NSLog(@"renderBuffer was presented from %d try");
}
unsigned RenderBuffer::width() const
{
return m_width;
}
unsigned RenderBuffer::height() const
{
return m_height;

View file

@ -34,7 +34,7 @@ namespace iphone
shared_ptr<yg::gl::RenderContext> createShared();
/// @TODO
void endThreadDrawing() {}
EAGLContext * getEAGLContext();
};
}

View file

@ -9,33 +9,33 @@
#include "RenderContext.hpp"
namespace iphone
namespace iphone
{
RenderContext::RenderContext()
RenderContext::RenderContext()
{
m_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
}
RenderContext::RenderContext(RenderContext * renderContext)
{
m_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1 sharegroup:renderContext->m_context.sharegroup];
}
RenderContext::~RenderContext()
{
[m_context release];
}
void RenderContext::makeCurrent()
{
[EAGLContext setCurrentContext:m_context];
}
shared_ptr<yg::gl::RenderContext> RenderContext::createShared()
{
return shared_ptr<yg::gl::RenderContext>(new RenderContext(this));
}
EAGLContext * RenderContext::getEAGLContext()
{
return m_context;

View file

@ -3,10 +3,10 @@
#include "../../../geometry/point2d.hpp"
@protocol UserLocationControllerDelegate
@protocol UserLocationControllerDelegate
@required
- (void) OnLocation: (m2::PointD const &) mercatorPoint
- (void) OnLocation: (m2::PointD const &) mercatorPoint
withConfidenceRadius: (double) confidenceRadius
withTimestamp: (NSDate *) timestamp;
- (void) OnHeading: (CLHeading *)heading;
@ -17,7 +17,7 @@ withConfidenceRadius: (double) confidenceRadius
{
@private
CLLocationManager * m_locationManager;
@public
id delegate;
BOOL active;

View file

@ -64,16 +64,16 @@
{
m2::PointD mercPoint(MercatorBounds::LonToX(newLocation.coordinate.longitude),
MercatorBounds::LatToY(newLocation.coordinate.latitude));
double confidenceRadius = sqrt(newLocation.horizontalAccuracy * newLocation.horizontalAccuracy
double confidenceRadius = sqrt(newLocation.horizontalAccuracy * newLocation.horizontalAccuracy
+ newLocation.verticalAccuracy * newLocation.verticalAccuracy);
m2::RectD errorRect = MercatorBounds::ErrorToRadius(newLocation.coordinate.longitude,
m2::RectD errorRect = MercatorBounds::ErrorToRadius(newLocation.coordinate.longitude,
newLocation.coordinate.latitude,
confidenceRadius);
confidenceRadius = sqrt((errorRect.SizeX() * errorRect.SizeX() + errorRect.SizeY() * errorRect.SizeY()) / 4);
[self.delegate OnLocation: mercPoint withConfidenceRadius: confidenceRadius withTimestamp: newLocation.timestamp];
}

View file

@ -13,14 +13,14 @@
#import "EAGLView.hpp"
namespace iphone
{
{
class WindowHandle : public ::WindowHandle
{
private:
EAGLView * m_view;
public:
WindowHandle(EAGLView * view);
void invalidateImpl();
};
}

View file

@ -17,7 +17,7 @@ namespace iphone
{
m_view = view;
}
void WindowHandle::invalidateImpl()
{
[m_view drawViewOnMainThread];

View file

@ -84,18 +84,18 @@
/* Begin PBXFileReference section */
1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1D3623240D0F684500981E51 /* MapsAppDelegate.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = MapsAppDelegate.hpp; sourceTree = "<group>"; };
1D3623250D0F684500981E51 /* MapsAppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MapsAppDelegate.mm; sourceTree = "<group>"; };
1D3623250D0F684500981E51 /* MapsAppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = MapsAppDelegate.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
1D6058910D05DD3D006BFB54 /* MapsWithMe.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MapsWithMe.app; sourceTree = BUILT_PRODUCTS_DIR; };
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
288765070DF74369002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
28A0AB4B0D9B1048005BE974 /* Maps_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Maps_Prefix.pch; sourceTree = "<group>"; };
28A0AB4B0D9B1048005BE974 /* Maps_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Maps_Prefix.pch; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
28AD73870D9D96C1002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = SOURCE_ROOT; };
29B97316FDCFA39411CA2CEA /* main.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = main.mm; sourceTree = "<group>"; };
46F26C7210F61FD600ECCA39 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
46F26CD610F623BA00ECCA39 /* EAGLView.hpp */ = {isa = PBXFileReference; fileEncoding = 11; lastKnownFileType = sourcecode.cpp.h; path = EAGLView.hpp; sourceTree = "<group>"; };
46F26CD710F623BA00ECCA39 /* EAGLView.mm */ = {isa = PBXFileReference; fileEncoding = 11; lastKnownFileType = sourcecode.cpp.objcpp; path = EAGLView.mm; sourceTree = "<group>"; };
46F26CD610F623BA00ECCA39 /* EAGLView.hpp */ = {isa = PBXFileReference; fileEncoding = 11; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = EAGLView.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
46F26CD710F623BA00ECCA39 /* EAGLView.mm */ = {isa = PBXFileReference; fileEncoding = 11; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = EAGLView.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
46F26D1E10F626CB00ECCA39 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
46F8A2EB10EB63040045521A /* MapViewController.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = MapViewController.hpp; sourceTree = "<group>"; };
46F8A2EB10EB63040045521A /* MapViewController.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = MapViewController.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
8D1107310486CEB800E47090 /* MapsWithMe-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "MapsWithMe-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
EE026F0511D6AC0D00645242 /* classificator.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = classificator.txt; path = ../../data/classificator.txt; sourceTree = SOURCE_ROOT; };
EE026F0811D6AC2800645242 /* basic.skn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = basic.skn; path = ../../data/basic.skn; sourceTree = SOURCE_ROOT; };
@ -109,17 +109,17 @@
EE12020511CD464100ABDD5D /* libindexer.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libindexer.a; sourceTree = SOURCE_ROOT; };
EE12020611CD464100ABDD5D /* libmap.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libmap.a; sourceTree = SOURCE_ROOT; };
EE12020811CD464100ABDD5D /* libyg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libyg.a; sourceTree = SOURCE_ROOT; };
EE16192B126E374500622BD0 /* RenderContext.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = RenderContext.hpp; path = Classes/RenderContext.hpp; sourceTree = SOURCE_ROOT; };
EE16192B126E374500622BD0 /* RenderContext.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; name = RenderContext.hpp; path = Classes/RenderContext.hpp; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
EE583CBA12F773F00042CBE3 /* unicode_blocks.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = unicode_blocks.txt; path = ../../data/unicode_blocks.txt; sourceTree = "<group>"; };
EE7F297C1219ECA300EB67A9 /* RenderBuffer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = RenderBuffer.hpp; path = Classes/RenderBuffer.hpp; sourceTree = SOURCE_ROOT; };
EE7F297D1219ECA300EB67A9 /* RenderBuffer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RenderBuffer.mm; path = Classes/RenderBuffer.mm; sourceTree = SOURCE_ROOT; };
EE7F297E1219ECA300EB67A9 /* RenderContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RenderContext.mm; path = Classes/RenderContext.mm; sourceTree = SOURCE_ROOT; };
EE7F297F1219ECA300EB67A9 /* WindowHandle.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = WindowHandle.hpp; path = Classes/WindowHandle.hpp; sourceTree = SOURCE_ROOT; };
EE7F29801219ECA300EB67A9 /* WindowHandle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WindowHandle.mm; path = Classes/WindowHandle.mm; sourceTree = SOURCE_ROOT; };
EE7F297C1219ECA300EB67A9 /* RenderBuffer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; name = RenderBuffer.hpp; path = Classes/RenderBuffer.hpp; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
EE7F297D1219ECA300EB67A9 /* RenderBuffer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = RenderBuffer.mm; path = Classes/RenderBuffer.mm; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
EE7F297E1219ECA300EB67A9 /* RenderContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = RenderContext.mm; path = Classes/RenderContext.mm; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
EE7F297F1219ECA300EB67A9 /* WindowHandle.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; name = WindowHandle.hpp; path = Classes/WindowHandle.hpp; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
EE7F29801219ECA300EB67A9 /* WindowHandle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = WindowHandle.mm; path = Classes/WindowHandle.mm; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
EEB7E22111E9079400080A68 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
EEB7E30711E9094F00080A68 /* UserLocationController.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = UserLocationController.hpp; sourceTree = "<group>"; };
EEB7E30811E9094F00080A68 /* UserLocationController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserLocationController.mm; sourceTree = "<group>"; };
EED10A4411F78D120095FAD4 /* MapViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MapViewController.mm; sourceTree = "<group>"; };
EEB7E30711E9094F00080A68 /* UserLocationController.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = UserLocationController.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
EEB7E30811E9094F00080A68 /* UserLocationController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = UserLocationController.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
EED10A4411F78D120095FAD4 /* MapViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = MapViewController.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
EEE4C93D1298A2F3007231A9 /* symbols_24.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = symbols_24.png; path = ../../data/symbols_24.png; sourceTree = SOURCE_ROOT; };
EEE4C93F1298A303007231A9 /* symbols_48.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = symbols_48.png; path = ../../data/symbols_48.png; sourceTree = SOURCE_ROOT; };
EEE4C9411298A31B007231A9 /* basic_highres.skn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = basic_highres.skn; path = ../../data/basic_highres.skn; sourceTree = SOURCE_ROOT; };
@ -148,10 +148,10 @@
FA065FFE1286167A00FEA989 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = SOURCE_ROOT; };
FA0660011286168700FEA989 /* Default-Portrait.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait.png"; sourceTree = SOURCE_ROOT; };
FA0660021286168700FEA989 /* Default-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape.png"; sourceTree = SOURCE_ROOT; };
FA4135E1120A263C0062D5B4 /* CountriesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CountriesViewController.h; path = Settings/CountriesViewController.h; sourceTree = SOURCE_ROOT; };
FA4135E2120A263C0062D5B4 /* CountriesViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CountriesViewController.mm; path = Settings/CountriesViewController.mm; sourceTree = SOURCE_ROOT; };
FA4135E1120A263C0062D5B4 /* CountriesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = CountriesViewController.h; path = Settings/CountriesViewController.h; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
FA4135E2120A263C0062D5B4 /* CountriesViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = CountriesViewController.mm; path = Settings/CountriesViewController.mm; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
FA4135E6120A263C0062D5B4 /* SettingsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SettingsManager.h; path = Settings/SettingsManager.h; sourceTree = SOURCE_ROOT; };
FA4135E7120A263C0062D5B4 /* SettingsManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SettingsManager.mm; path = Settings/SettingsManager.mm; sourceTree = SOURCE_ROOT; };
FA4135E7120A263C0062D5B4 /* SettingsManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = SettingsManager.mm; path = Settings/SettingsManager.mm; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
FA46DA0412D414D200968C36 /* maps.update */ = {isa = PBXFileReference; lastKnownFileType = file; name = maps.update; path = ../../data/maps.update; sourceTree = SOURCE_ROOT; };
FA46DA2B12D4166E00968C36 /* countries.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = countries.txt; path = ../../data/countries.txt; sourceTree = SOURCE_ROOT; };
FA50055C1287BFCE002961F0 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = SOURCE_ROOT; };
@ -163,12 +163,12 @@
FA500587128907F0002961F0 /* visibility.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = visibility.txt; path = ../../data/visibility.txt; sourceTree = SOURCE_ROOT; };
FA57ADF312F338FB002BFB9D /* countries_poly.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = countries_poly.txt; path = ../../data/countries_poly.txt; sourceTree = SOURCE_ROOT; };
FA87151A12B1518F00592DAF /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
FA8F8937132D5DB00048E3FE /* libtomcrypt.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libtomcrypt.a; path = libtomcrypt.a; sourceTree = SOURCE_ROOT; };
FAF37EFA126DCE6F005EA154 /* IPhoneDownload.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = IPhoneDownload.mm; path = Platform/IPhoneDownload.mm; sourceTree = SOURCE_ROOT; };
FAF37EFB126DCE6F005EA154 /* IPhoneDownloadManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = IPhoneDownloadManager.mm; path = Platform/IPhoneDownloadManager.mm; sourceTree = SOURCE_ROOT; };
FAF37EFD126DCE6F005EA154 /* IPhonePlatform.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = IPhonePlatform.mm; path = Platform/IPhonePlatform.mm; sourceTree = SOURCE_ROOT; };
FAF37EFE126DCE6F005EA154 /* IPhonePlatform.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = IPhonePlatform.hpp; path = Platform/IPhonePlatform.hpp; sourceTree = SOURCE_ROOT; };
FAF37F03126DCF11005EA154 /* IPhoneDownload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IPhoneDownload.h; path = Platform/IPhoneDownload.h; sourceTree = SOURCE_ROOT; };
FA8F8937132D5DB00048E3FE /* libtomcrypt.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libtomcrypt.a; sourceTree = SOURCE_ROOT; };
FAF37EFA126DCE6F005EA154 /* IPhoneDownload.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = IPhoneDownload.mm; path = Platform/IPhoneDownload.mm; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
FAF37EFB126DCE6F005EA154 /* IPhoneDownloadManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = IPhoneDownloadManager.mm; path = Platform/IPhoneDownloadManager.mm; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
FAF37EFD126DCE6F005EA154 /* IPhonePlatform.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = IPhonePlatform.mm; path = Platform/IPhonePlatform.mm; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
FAF37EFE126DCE6F005EA154 /* IPhonePlatform.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; name = IPhonePlatform.hpp; path = Platform/IPhonePlatform.hpp; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
FAF37F03126DCF11005EA154 /* IPhoneDownload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = IPhoneDownload.h; path = Platform/IPhoneDownload.h; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */

View file

@ -5,5 +5,5 @@
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import <CoreLocation/CoreLocation.h>
#endif

View file

@ -13,10 +13,10 @@
int64_t m_projectedFileSize;
string m_url;
NSURLConnection * m_connection;
TDownloadFinishedFunction m_finishObserver;
TDownloadProgressFunction m_progressObserver;
NSInteger m_retryCounter;
}

View file

@ -92,7 +92,7 @@ NSString * GetEncryptedMac()
[request addValue:val forHTTPHeaderField:@"Range"];
[val release];
}
static NSString * macStr = GetEncryptedMac();
if (macStr)
[request addValue:macStr forHTTPHeaderField:@"User-Agent"];
@ -105,9 +105,9 @@ NSString * GetEncryptedMac()
{
m_finishObserver = finishFunc;
m_progressObserver = progressFunc;
m_retryCounter = 0;
// try to create file first
std::string tmpFile = file;
tmpFile += DOWNLOADING_FILE_EXTENSION;
@ -123,10 +123,10 @@ NSString * GetEncryptedMac()
m_requestedFileName = file;
m_url = originalUrl;
// create the connection with the request and start loading the data
m_connection = [[NSURLConnection alloc] initWithRequest:[self CreateRequest] delegate:self];
if (m_connection == 0)
{
NSLog(@"Can't create connection for url %s", originalUrl);
@ -143,7 +143,7 @@ NSString * GetEncryptedMac()
{
// This method is called when the server has determined that it
// has enough information to create the NSURLResponse.
// check if this is OK (not a 404 or the like)
if ([response respondsToSelector:@selector(statusCode)])
{
@ -163,7 +163,7 @@ NSString * GetEncryptedMac()
return;
}
}
m_projectedFileSize = [response expectedContentLength];
// if server doesn't support resume, make sure we're downloading file from scratch
if (m_projectedFileSize < 0)
@ -186,24 +186,24 @@ NSString * GetEncryptedMac()
{
// inform the user
NSLog(@"Connection failed for url %s\n%@", m_url.c_str(), [error localizedDescription]);
// retry connection if it's network-specific error
if ([error code] < 0 && ++m_retryCounter <= MAX_AUTOMATIC_RETRIES)
{
[m_connection release];
// create the connection with the request and start loading the data
m_connection = [[NSURLConnection alloc] initWithRequest:[self CreateRequest] delegate:self];
if (m_connection)
{
NSLog(@"Retrying %d time", m_retryCounter);
return; // successfully restarted connection
}
NSLog(@"Can't retry connection");
// notify observer about error and exit after this if-block
}
if (m_finishObserver)
m_finishObserver(m_url.c_str(), EHttpDownloadFailed);
// and selfdestruct...
@ -221,13 +221,13 @@ NSString * GetEncryptedMac()
if (rename((m_requestedFileName + DOWNLOADING_FILE_EXTENSION).c_str(), m_requestedFileName.c_str()))
{
resultForGUI = false;
NSLog(@"Can't rename to file %s", m_requestedFileName.c_str());
NSLog(@"Can't rename to file %s", m_requestedFileName.c_str());
}
else
{
NSLog(@"Successfully downloaded %s", m_url.c_str());
}
if (m_finishObserver)
m_finishObserver(m_url.c_str(), resultForGUI ? EHttpDownloadOk : EHttpDownloadFileIsLocked);
// and selfdestruct...

View file

@ -7,13 +7,13 @@
class IPhoneDownloadManager : public DownloadManager
{
NSMutableArray * activeDownloads;
public:
IPhoneDownloadManager()
{
activeDownloads = [[NSMutableArray alloc] init];
}
virtual ~IPhoneDownloadManager()
{
for (NSUInteger i = 0; i < [activeDownloads count]; ++i)
@ -38,7 +38,7 @@ public:
}
IPhoneDownload * download = [[IPhoneDownload alloc] init];
if ([download StartDownloadWithUrl:url
if ([download StartDownloadWithUrl:url
andFile:fileName
andFinishFunc:finishFunc
andProgressFunc:progressFunc
@ -74,7 +74,7 @@ public:
if ([activeDownloads count] == 0)
[UIApplication sharedApplication].idleTimerDisabled = NO;
}
virtual void CancelAllDownloads()
{
for (NSUInteger i = 0; i < [activeDownloads count]; ++i) {

View file

@ -25,7 +25,7 @@ public:
virtual bool IsVisualLog() const;
virtual string const DeviceID() const;
virtual unsigned ScaleEtalonSize() const;
private:
string m_deviceID;
string m_skinName;

View file

@ -13,20 +13,20 @@
IPhonePlatform::IPhonePlatform()
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSBundle * bundle = [NSBundle mainBundle];
NSString * path = [bundle resourcePath];
m_resourcesPath = [path UTF8String];
m_resourcesPath += '/';
NSArray * dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * docsDir = [dirPaths objectAtIndex:0];
m_writablePath = [docsDir UTF8String];
m_writablePath += '/';
m_StartDate = [[NSDate alloc] init];
/// Hardcoding screen resolution depending on the device we are running.
m_visualScale = 1.0;
m_skinName = "basic.skn";
@ -36,7 +36,7 @@ IPhonePlatform::IPhonePlatform()
/// Calculating resolution
UIDevice * device = [UIDevice currentDevice];
NSRange range = [device.name rangeOfString:@"iPad"];
if (range.location != NSNotFound)
{
@ -59,9 +59,9 @@ IPhonePlatform::IPhonePlatform()
}
}
}
m_scaleEtalonSize = (256 * 1.5) * m_visualScale;
NSLog(@"Device Name : %@, SystemName : %@, SystemVersion : %@", device.name, device.systemName, device.systemVersion);
[pool release];
@ -106,7 +106,7 @@ int IPhonePlatform::GetFilesInDir(string const & directory, string const & mask,
string mask_fixed = mask;
if (mask_fixed.size() && mask_fixed[0] == '*')
mask_fixed.erase(0, 1);
do
{
if ((entry = readdir(dir)) != NULL)
@ -127,7 +127,7 @@ int IPhonePlatform::GetFilesInDir(string const & directory, string const & mask,
} while (entry != NULL);
closedir(dir);
return outFiles.size();
}
@ -187,10 +187,10 @@ vector<string> IPhonePlatform::GetFontNames() const
GetFilesInDir(fontFolder, ".ttf", res);
for (size_t i = 0; i < res.size(); ++i)
res[i] = fontFolder + res[i];
return res;
}
bool IPhonePlatform::IsBenchmarking() const
{
return false;

View file

@ -2,7 +2,7 @@
#include "../../../storage/storage.hpp"
@interface CountriesViewController
@interface CountriesViewController
: UIViewController <UINavigationBarDelegate, UITableViewDelegate, UITableViewDataSource, UIActionSheetDelegate>
{
storage::Storage * m_storage;

View file

@ -9,7 +9,7 @@
#define MAX_3G_MEGABYTES 100
#define GB 1000*1000*1000
#define MB 1000*1000
#define MB 1000*1000
using namespace storage;
@ -44,7 +44,7 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
theirsFixed.m_country = -1;
else
theirsFixed.m_group = -1;
return ours == theirsFixed;
}
@ -77,7 +77,7 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
countriesTableView.delegate = self;
countriesTableView.dataSource = self;
self.view = countriesTableView;
[countriesTableView release];
[countriesTableView release];
}
// Override to allow orientations other than the default portrait orientation.
@ -92,7 +92,7 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
//}
//
//- (NSString *) tableView: (UITableView *)tableView titleForHeaderInSection: (NSInteger)section
//{
//{
// return nil;
//}
@ -128,9 +128,9 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
else
{
kBorMBorGB = "kB";
size = (size + 999) / 1000;
size = (size + 999) / 1000;
}
cell.textLabel.textColor = [UIColor greenColor];
cell.detailTextLabel.text = [NSString stringWithFormat: @"Downloaded (%qu %s), touch to delete", size, kBorMBorGB];
cell.accessoryView = nil;
@ -151,7 +151,7 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
}
break;
case EDownloadFailed:
cell.textLabel.textColor = [UIColor redColor];
cell.textLabel.textColor = [UIColor redColor];
cell.detailTextLabel.text = @"Download has failed, touch again for one more try";
cell.accessoryView = nil;
break;
@ -182,10 +182,10 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
// Customize the appearance of table view cells.
- (UITableViewCell *) tableView: (UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
{
TIndex index = CalculateIndex(m_index, indexPath);
bool hasChildren = m_storage->CountriesCount(index) != 0;
NSString * cellId = hasChildren ? @"ParentCell" : @"DetailCell";
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: cellId];
if (cell == nil)
@ -232,7 +232,7 @@ TIndex g_clickedIndex;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
// Recover reachability flags
SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress);
SCNetworkReachabilityFlags flags;
@ -240,7 +240,7 @@ TIndex g_clickedIndex;
CFRelease(defaultRouteReachability);
if (!didRetrieveFlags)
return NO;
BOOL isReachable = flags & kSCNetworkFlagsReachable;
BOOL isWifi = !(flags & kSCNetworkReachabilityFlagsIsWWAN);
BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired;
@ -287,7 +287,7 @@ TIndex g_clickedIndex;
case EDownloadFailed:
{ // display confirmation popup with country size
BOOL isWifiConnected = [CountriesViewController IsUsingWIFI];
TLocalAndRemoteSize sizePair = m_storage->CountrySizeInBytes(g_clickedIndex);
TLocalAndRemoteSize::first_type size = sizePair.second - sizePair.first;
// convert size to human readable values
@ -328,7 +328,7 @@ TIndex g_clickedIndex;
[popupQuery showFromRect: [cell frame] inView: tableView animated: YES];
else
[popupQuery showInView: tableView];
[popupQuery release];
[popupQuery release];
}
break;
case EDownloading:

View file

@ -55,7 +55,7 @@ using namespace storage;
CountriesViewController * rootViewController = [[CountriesViewController alloc] initWithStorage:storage
andIndex:TIndex() andHeader:@"Download"];
g_navController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
// tricky boost::bind for objC class methods
typedef void (*TChangeFunc)(id, SEL, TIndex const &);
SEL changeSel = @selector(OnCountryChange:);