Skip to content

Commit fad7035

Browse files
lufinkeylufinkey
lufinkey
authored and
lufinkey
committed
Added Project Properties
Added a screen to edit project properties. Also other bug fixes
1 parent 8b65cbd commit fad7035

23 files changed

+819
-45
lines changed

Source/DeprecationFix/UIColorDeprecationFix.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ + (UIColor*)groupTableViewBackgroundColor
2222
CGContextFillRect(c, CGRectMake(4, 0, 1, 1));
2323
[[UIColor colorWithRed:192/255.f green:200/255.f blue:207/255.f alpha:1.f] setFill];
2424
CGContextFillRect(c, CGRectMake(5, 0, 2, 1));
25-
tableViewBackgroundImage = UIGraphicsGetImageFromCurrentImageContext();
25+
tableViewBackgroundImage = [UIGraphicsGetImageFromCurrentImageContext() retain];
2626
UIGraphicsEndImageContext();
2727
});
2828
return [self colorWithPatternImage:tableViewBackgroundImage];

Source/ObjCBridge/ObjCBridge.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,21 @@ void concatStrings(char*dest, const char*strs[], unsigned int sizeDest, unsigned
5454
}
5555
}
5656

57+
int compareStrings(const char* str, const char*cmp)
58+
{
59+
if(str==NULL)
60+
{
61+
return -1;
62+
}
63+
if(cmp==NULL)
64+
{
65+
return 1;
66+
}
67+
68+
String str1 = str;
69+
return str1.compare(cmp);
70+
}
71+
5772
class ThreadCallbackCaller : public Thread
5873
{
5974
private:

Source/ObjCBridge/ObjCBridge.h

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ void showSimpleMessageBox(const char*title, const char*message, const char*butto
1515

1616
void concatPath(char*dest, const char*path1, const char*path2, unsigned int size);
1717
void concatStrings(char*dest, const char*strs[], unsigned int sizeDest, unsigned int sizeStrs);
18+
int compareStrings(const char* str, const char*cmp);
1819

1920

2021
typedef void (*ThreadCallback)(void*);

Source/PreferencesView/AppManagerViewController.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ - (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger
188188
[indexes release];
189189

190190
NSMutableString* message = [[NSMutableString alloc] initWithString:pendingApp];
191-
[message appendString:@" was successfully uninstalled!"];
191+
[message appendString:@" was successfully uninstalled! You may have to wait a moment for the homescreen to refresh."];
192192
showSimpleMessageBox("Success", [message UTF8String]);
193193
[message release];
194194

Source/PreferencesView/GlobalPreferences.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ bool Global_checkSDKFolderValid(const char*folder)
247247
return false;
248248
}
249249

250-
return FileTools::folderExists(sdkFolder + '/' + defaultSDK);
250+
return FileTools::folderExists(sdkFolder + '/' + folder);
251251
}
252252
return false;
253253
}

Source/PreferencesView/PreferencesViewController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
- (void)cancelFileExplorer;
1515

1616
@property (nonatomic, retain) UITableView* preferences;
17-
@property (nonatomic, retain) UIFileBrowserViewController* fileExplorer;
17+
@property (nonatomic, assign) UIFileBrowserViewController* fileExplorer;
1818

1919
@end

Source/PreferencesView/PreferencesViewController.mm

+28-15
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
#import "../IconManager/IconManager.h"
44
#import "../ObjCBridge/ObjCBridge.h"
55
#import "../Navigation/UINavigator.h"
6+
#import "../Util/UIBarImageButtonItem.h"
67
#import "GlobalPreferences.h"
78
#import "FontSelectorViewController.h"
89
#import "FontSizePreviewViewController.h"
910
#import "AppManagerViewController.h"
1011

12+
@interface PreferencesViewController()
13+
- (void)onSDKInfoButtonSelected;
14+
@end
15+
1116
@implementation PreferencesViewController
1217

1318
@synthesize preferences;
@@ -20,6 +25,8 @@ - (id)init
2025
return nil;
2126
}
2227

28+
fileExplorer = nil;
29+
2330
UIBarButtonItem*doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneButtonSelected)];
2431
[self.navigationItem setTitle:@"Preferences"];
2532
[self.navigationItem setRightBarButtonItem:doneButton];
@@ -43,11 +50,6 @@ - (void)viewWillAppear:(BOOL)animated
4350
- (void)viewDidAppear:(BOOL)animated
4451
{
4552
[super viewDidAppear:animated];
46-
if(fileExplorer!=nil)
47-
{
48-
[fileExplorer release];
49-
fileExplorer = nil;
50-
}
5153
}
5254

5355
- (void)doneButtonSelected
@@ -173,11 +175,19 @@ - (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)
173175
{
174176
NSString* sdkPath = [[NSString alloc] initWithUTF8String:Global_getSDKFolderPath()];
175177
fileExplorer = [[UIFileBrowserViewController alloc] initWithString:@"" root:sdkPath delegate:self];
176-
UIBarButtonItem* cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelFileExplorer)];
177-
[fileExplorer.navigationBar setBarStyle:UIBarStyleBlack];
178-
[fileExplorer.navigationBar.topItem setLeftBarButtonItem:cancelButton];
179-
[cancelButton release];
180-
[self presentModalViewController:fileExplorer animated:YES];
178+
if(fileExplorer!=nil)
179+
{
180+
[fileExplorer setDelegate:self];
181+
[fileExplorer.navigationBar setBarStyle:UIBarStyleBlack];
182+
UIBarButtonItem* cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelFileExplorer)];
183+
[fileExplorer.navigationBar.topItem setLeftBarButtonItem:cancelButton];
184+
[cancelButton release];
185+
UIBarButtonItem* infoButton = [[UIBarImageButtonItem alloc] initWithType:UIButtonTypeInfoLight target:self action:@selector(onSDKInfoButtonSelected)];
186+
[fileExplorer.navigationBar.topItem setRightBarButtonItem:infoButton];
187+
[infoButton release];
188+
[self presentModalViewController:fileExplorer animated:YES];
189+
[fileExplorer release];
190+
}
181191
[sdkPath release];
182192
}
183193
break;
@@ -257,13 +267,16 @@ - (void)fileBrowser:(UIFileBrowserViewController*)fileBrowser didSelectFolder:(N
257267
[fileExplorer dismissModalViewControllerAnimated:YES];
258268
}
259269

270+
- (void)onSDKInfoButtonSelected
271+
{
272+
const char* message = "SDKs can be added by copying a .sdk package from xcode to /var/stash/Developer/SDKs on your device.\n\n"
273+
"If you have issues, you may need to zip the package before you copy it, and then unzip it on the device. "
274+
"Sometimes symbolic links can get messed up.";
275+
showSimpleMessageBox(NULL, message);
276+
}
277+
260278
- (void)dealloc
261279
{
262-
if(fileExplorer!=nil)
263-
{
264-
[fileExplorer release];
265-
fileExplorer = nil;
266-
}
267280
[preferences release];
268281
[super dealloc];
269282
}

Source/ProjectLoad/ProjLoadTools.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "../Util/FileTools.h"
77
#include "../Util/Console.h"
88
#include "../PreferencesView/GlobalPreferences.h"
9+
#include "../Util/AppManager.h"
910
#include <stdlib.h>
1011

1112
#include "TargetConditionals.h"
@@ -27,8 +28,7 @@ void ProjLoad_createDefaultFolders()
2728
FileTools::createDirectory(homeFolder + "/Library/miniCode");
2829
FileTools::createDirectory(homeFolder + "/Library/miniCode/projects");
2930
#if !(TARGET_IPHONE_SIMULATOR)
30-
FileTools::createDirectory("/var/stash/Developer");
31-
FileTools::createDirectory("/var/stash/Developer/SDKs");
31+
AppManager_createDefaultFolders();
3232
#endif
3333
}
3434

Source/ProjectView/CellHoldAction/LinkIncludeFolderAction.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void LinkIncludeFolderAction_AlertViewDismissHandler(void*data, int buttonIndex)
108108
if(realpath([extFolderString UTF8String], pathPtr)!=NULL)
109109
{
110110
[extFolderString release];
111-
extFolderString = [[NSString alloc] initWithUTF8String:pathPtr];
111+
extFolderString = [[NSMutableString alloc] initWithUTF8String:pathPtr];
112112
}
113113
NSFilePath* extPath = [[NSFilePath alloc] initWithString:extFolderString];
114114
[extFolderString release];

Source/ProjectView/PlistViewerViewController.h

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
#import "../ObjCBridge/ObjCBridge.h"
66
#import "../Util/UIDictionaryTableViewCell.h"
77

8+
@interface UIView (PlistViewHelper)
9+
10+
- (id)findFirstResponder;
11+
- (int)findHeightFromSuperview:(UIView*)superview;
12+
13+
@end
14+
815
@class PlistViewController;
916
@class PlistStringViewController;
1017
@class PlistDictionaryViewController;

Source/ProjectView/PlistViewerViewController.mm

-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414
static const int BRANCHTYPE_DICTIONARY = 5;
1515
static const int BRANCHTYPE_ARRAY = 6;
1616

17-
@interface UIView (PlistViewHelper)
18-
19-
- (id)findFirstResponder;
20-
- (int)findHeightFromSuperview:(UIView*)superview;
21-
22-
@end
2317

2418
@implementation UIView (PlistViewerHelper)
2519
- (id)findFirstResponder
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
#import "../Navigation/NavigatedViewController.h"
3+
#import "../Util/UIDictionaryTableViewCell.h"
4+
#import "../UIFileBrowserViewController/UIFileBrowserViewController.h"
5+
6+
@interface ProjectSettingsViewController : NavigatedViewController <UITableViewDelegate, UITableViewDataSource, UIDictionaryTableViewCellDelegate, UIFileBrowserDelegate>
7+
{
8+
UITableView* settingsTable;
9+
10+
NSString* name;
11+
NSString* author;
12+
NSString* bundleID;
13+
NSString* execName;
14+
NSString* prodName;
15+
NSString* sdk;
16+
17+
@private
18+
UIFileBrowserViewController* fileExplorer;
19+
}
20+
21+
- (void)applyButtonSelected;
22+
- (void)cancelButtonSelected;
23+
- (void)onSDKInfoButtonSelected;
24+
- (void)cancelFileExplorer;
25+
26+
- (void)keyboardDidHide:(NSNotification*)notification;
27+
- (void)keyboardDidShow:(NSNotification*)notification;
28+
29+
@property (nonatomic, readonly) UITableView* settingsTable;
30+
@property (nonatomic, retain) NSString* name;
31+
@property (nonatomic, retain) NSString* author;
32+
@property (nonatomic, retain) NSString* bundleID;
33+
@property (nonatomic, retain) NSString* execName;
34+
@property (nonatomic, retain) NSString* prodName;
35+
@property (nonatomic, retain) NSString* sdk;
36+
@end
37+
38+
@interface ProjectSettingsStringViewController : NavigatedViewController <UITextFieldDelegate>
39+
{
40+
UITextField* stringBox;
41+
NSIndexPath* indexPath;
42+
ProjectSettingsViewController* settingsController;
43+
}
44+
45+
- (id)initWithIndexPath:(NSIndexPath*)indexPath string:(NSString*)string settingsController:(ProjectSettingsViewController*)settingsController;
46+
47+
@property (nonatomic, retain) UITextField* stringBox;
48+
@property (nonatomic, readonly) NSIndexPath* indexPath;
49+
@property (nonatomic, assign) ProjectSettingsViewController* settingsController;
50+
@end

0 commit comments

Comments
 (0)