Skip to content

Commit

Permalink
Adding support for title.png image, making progress indicators indete…
Browse files Browse the repository at this point in the history
…rminate, fixing staircase min/max hit bug
  • Loading branch information
davidlawson committed Oct 4, 2015
1 parent 92052a8 commit 07c9422
Show file tree
Hide file tree
Showing 16 changed files with 311 additions and 29 deletions.
4 changes: 3 additions & 1 deletion PsyPad.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
63BF7A931ABEB6E600825F70 /* _RootEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _RootEntity.m; sourceTree = "<group>"; };
63BF7A941ABEB6E600825F70 /* RootEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootEntity.h; sourceTree = "<group>"; };
63BF7A951ABEB6E600825F70 /* RootEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootEntity.m; sourceTree = "<group>"; };
63C75B961BC0F5260071814B /* Model2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model2.xcdatamodel; sourceTree = "<group>"; };
63CD19361A9ABB74006946C5 /* LoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginViewController.h; sourceTree = "<group>"; };
63CD19371A9ABB74006946C5 /* LoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginViewController.m; sourceTree = "<group>"; };
63DC3D291696F9A600ACCFBE /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -1089,9 +1090,10 @@
63BF7A8F1ABEB62E00825F70 /* Model.xcdatamodeld */ = {
isa = XCVersionGroup;
children = (
63C75B961BC0F5260071814B /* Model2.xcdatamodel */,
63BF7A901ABEB62E00825F70 /* Model1.xcdatamodel */,
);
currentVersion = 63BF7A901ABEB62E00825F70 /* Model1.xcdatamodel */;
currentVersion = 63C75B961BC0F5260071814B /* Model2.xcdatamodel */;
path = Model.xcdatamodeld;
sourceTree = "<group>";
versionGroupType = wrapper.xcdatamodel;
Expand Down
Binary file not shown.
6 changes: 3 additions & 3 deletions PsyPad/Admin Panel/AdminPanelTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ - (void)loadServerParticipants
- (void)downloadParticipant:(NSString *)username
{
self.hud = [self createHUD];
self.hud.mode = MBProgressHUDModeDeterminate;
self.hud.mode = MBProgressHUDModeIndeterminate;
self.hud.labelText = @"Downloading participant...";

[[ServerManager sharedManager] downloadParticipant:username
Expand Down Expand Up @@ -284,7 +284,7 @@ - (void)downloadParticipant:(NSString *)username
- (void)uploadLogs
{
self.hud = [self createHUD];
self.hud.mode = MBProgressHUDModeDeterminate;
self.hud.mode = MBProgressHUDModeIndeterminate;
self.hud.labelText = @"Uploading...";

[[ServerManager sharedManager] uploadLogsWithProgress:^(NSString *status, float progress)
Expand Down Expand Up @@ -319,7 +319,7 @@ - (void)uploadLogs
- (void)downloadAllParticipants
{
self.hud = [self createHUD];
self.hud.mode = MBProgressHUDModeDeterminate;
self.hud.mode = MBProgressHUDModeIndeterminate;
self.hud.labelText = @"Downloading participants...";

[[ServerManager sharedManager] downloadAllParticipants:^(NSString *status, float progress)
Expand Down
2 changes: 1 addition & 1 deletion PsyPad/Database/DatabaseManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ @implementation DatabaseManager

+ (NSString *)modelFileName { return @"Model.momd"; }
+ (NSString *)storeFileName { return @"Database.sqlite"; }
+ (NSArray *)modelNames { return @[@"Model1"]; }
+ (NSArray *)modelNames { return @[@"Model1", @"Model2"]; }
+ (NSString *)iCloudContainer { return nil; }
+ (NSString *)iCloudContentNameKey { return nil; }

Expand Down
2 changes: 1 addition & 1 deletion PsyPad/Database/Model.xcdatamodeld/.xccurrentversion
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>_XCCurrentVersionName</key>
<string>Model1.xcdatamodel</string>
<string>Model2.xcdatamodel</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model userDefinedModelVersionIdentifier="2" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="7549" systemVersion="14C1510" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic">
<model userDefinedModelVersionIdentifier="2" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="8195" systemVersion="14F27" minimumToolsVersion="Xcode 4.3">
<entity name="RootEntity" representedClassName="RootEntity" syncable="YES">
<attribute name="admin_password" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="authToken" optional="YES" attributeType="String" syncable="YES"/>
Expand Down Expand Up @@ -131,7 +131,7 @@
<element name="TestConfiguration" positionX="0" positionY="0" width="128" height="1215"/>
<element name="TestLog" positionX="0" positionY="0" width="128" height="105"/>
<element name="TestLogItem" positionX="0" positionY="0" width="128" height="105"/>
<element name="TestSequence" positionX="0" positionY="0" width="128" height="148"/>
<element name="TestSequence" positionX="0" positionY="0" width="128" height="150"/>
<element name="TestSequenceFolder" positionX="0" positionY="0" width="128" height="90"/>
<element name="TestSequenceImage" positionX="0" positionY="0" width="128" height="135"/>
<element name="User" positionX="0" positionY="0" width="128" height="90"/>
Expand Down
141 changes: 141 additions & 0 deletions PsyPad/Database/Model.xcdatamodeld/Model2.xcdatamodel/contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model userDefinedModelVersionIdentifier="2" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="8195" systemVersion="14F27" minimumToolsVersion="Xcode 4.3">
<entity name="RootEntity" representedClassName="RootEntity" syncable="YES">
<attribute name="admin_password" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="authToken" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="demoMode" attributeType="Boolean" defaultValueString="YES" syncable="YES"/>
<attribute name="email" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="server_url" attributeType="String" defaultValueString="http://server.psypad.net.au/" syncable="YES"/>
</entity>
<entity name="TestConfiguration" representedClassName="TestConfiguration" syncable="YES">
<attribute name="animation_frame_rate" attributeType="Integer 16" syncable="YES"/>
<attribute name="attempt_facial_recognition" attributeType="Boolean" syncable="YES"/>
<attribute name="background_colour" attributeType="String" syncable="YES"/>
<attribute name="button_presentation_delay" attributeType="Float" syncable="YES"/>
<attribute name="button1_bg" attributeType="String" syncable="YES"/>
<attribute name="button1_fg" attributeType="String" syncable="YES"/>
<attribute name="button1_h" attributeType="Integer 16" syncable="YES"/>
<attribute name="button1_text" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="button1_w" attributeType="Integer 16" syncable="YES"/>
<attribute name="button1_x" attributeType="Integer 16" syncable="YES"/>
<attribute name="button1_y" attributeType="Integer 16" syncable="YES"/>
<attribute name="button2_bg" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="button2_fg" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="button2_h" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="button2_text" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="button2_w" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="button2_x" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="button2_y" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="button3_bg" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="button3_fg" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="button3_h" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="button3_text" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="button3_w" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="button3_x" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="button3_y" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="button4_bg" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="button4_fg" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="button4_h" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="button4_text" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="button4_w" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="button4_x" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="button4_y" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="configuration_description" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="day_of_week_fri" attributeType="Boolean" syncable="YES"/>
<attribute name="day_of_week_mon" attributeType="Boolean" syncable="YES"/>
<attribute name="day_of_week_sat" attributeType="Boolean" syncable="YES"/>
<attribute name="day_of_week_sun" attributeType="Boolean" syncable="YES"/>
<attribute name="day_of_week_thu" attributeType="Boolean" syncable="YES"/>
<attribute name="day_of_week_tue" attributeType="Boolean" syncable="YES"/>
<attribute name="day_of_week_wed" attributeType="Boolean" syncable="YES"/>
<attribute name="delta_values" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="enabled" attributeType="Boolean" syncable="YES"/>
<attribute name="exit_button_bg" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="exit_button_fg" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="exit_button_h" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="exit_button_w" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="exit_button_x" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="exit_button_y" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="finite_presentation_time" optional="YES" attributeType="Float" syncable="YES"/>
<attribute name="finite_response_window" optional="YES" attributeType="Float" syncable="YES"/>
<attribute name="hits_to_finish" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="infinite_presentation_time" attributeType="Boolean" syncable="YES"/>
<attribute name="infinite_response_window" attributeType="Boolean" syncable="YES"/>
<attribute name="is_gallery_configuration" attributeType="Boolean" syncable="YES"/>
<attribute name="is_practice" attributeType="Boolean" syncable="YES"/>
<attribute name="loop_animations" attributeType="Boolean" syncable="YES"/>
<attribute name="maximum_level" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="minimum_level" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="name" attributeType="String" syncable="YES"/>
<attribute name="num_buttons" attributeType="Integer 16" syncable="YES"/>
<attribute name="num_correct_to_get_harder" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="num_wrong_to_get_easier" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="number_of_reversals" attributeType="String" syncable="YES"/>
<attribute name="number_of_staircases" optional="YES" attributeType="Integer 16" syncable="YES"/>
<attribute name="questions_per_folder" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="require_next" attributeType="Boolean" syncable="YES"/>
<attribute name="server_id" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="server_url" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="show_exit_button" attributeType="Boolean" syncable="YES"/>
<attribute name="specified_seed" optional="YES" attributeType="Integer 32" syncable="YES"/>
<attribute name="start_level" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="time_between_question_mean" attributeType="Float" syncable="YES"/>
<attribute name="time_between_question_plusminus" attributeType="Float" syncable="YES"/>
<attribute name="title" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="use_specified_seed" attributeType="Boolean" syncable="YES"/>
<attribute name="use_staircase_method" attributeType="Boolean" syncable="YES"/>
<relationship name="sequence" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="TestSequence" inverseName="testConfigurations" inverseEntity="TestSequence" syncable="YES"/>
<relationship name="user" optional="YES" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="User" inverseName="configurations" inverseEntity="User" syncable="YES"/>
</entity>
<entity name="TestLog" representedClassName="TestLog" syncable="YES">
<attribute name="timestamp" attributeType="Date" syncable="YES"/>
<attribute name="uploaded" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<relationship name="logitems" optional="YES" toMany="YES" deletionRule="Cascade" ordered="YES" destinationEntity="TestLogItem" inverseName="log" inverseEntity="TestLogItem" syncable="YES"/>
<relationship name="user" optional="YES" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="User" inverseName="logs" inverseEntity="User" syncable="YES"/>
</entity>
<entity name="TestLogItem" representedClassName="TestLogItem" syncable="YES">
<attribute name="info" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="timestamp" attributeType="Date" syncable="YES"/>
<attribute name="type" attributeType="String" syncable="YES"/>
<relationship name="log" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="TestLog" inverseName="logitems" inverseEntity="TestLog" syncable="YES"/>
</entity>
<entity name="TestSequence" representedClassName="TestSequence" syncable="YES">
<attribute name="background_length" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
<attribute name="background_start" optional="YES" attributeType="Integer 64" defaultValueString="0" syncable="YES"/>
<attribute name="name" attributeType="String" syncable="YES"/>
<attribute name="path" attributeType="String" syncable="YES"/>
<attribute name="title_length" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
<attribute name="title_start" optional="YES" attributeType="Integer 64" defaultValueString="0" syncable="YES"/>
<attribute name="url" optional="YES" attributeType="String" syncable="YES"/>
<relationship name="folders" optional="YES" toMany="YES" deletionRule="Cascade" ordered="YES" destinationEntity="TestSequenceFolder" inverseName="sequence" inverseEntity="TestSequenceFolder" syncable="YES"/>
<relationship name="testConfigurations" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="TestConfiguration" inverseName="sequence" inverseEntity="TestConfiguration" syncable="YES"/>
</entity>
<entity name="TestSequenceFolder" representedClassName="TestSequenceFolder" syncable="YES">
<attribute name="name" attributeType="String" syncable="YES"/>
<relationship name="images" optional="YES" toMany="YES" deletionRule="Cascade" ordered="YES" destinationEntity="TestSequenceImage" inverseName="folder" inverseEntity="TestSequenceImage" syncable="YES"/>
<relationship name="sequence" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="TestSequence" inverseName="folders" inverseEntity="TestSequence" syncable="YES"/>
</entity>
<entity name="TestSequenceImage" representedClassName="TestSequenceImage" syncable="YES">
<attribute name="animated_images" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="is_animated" attributeType="Boolean" syncable="YES"/>
<attribute name="length" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
<attribute name="name" attributeType="String" syncable="YES"/>
<attribute name="start" optional="YES" attributeType="Integer 64" defaultValueString="0" syncable="YES"/>
<relationship name="folder" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="TestSequenceFolder" inverseName="images" inverseEntity="TestSequenceFolder" syncable="YES"/>
</entity>
<entity name="User" representedClassName="User" syncable="YES">
<attribute name="id" attributeType="String" syncable="YES"/>
<relationship name="configurations" optional="YES" toMany="YES" deletionRule="Nullify" ordered="YES" destinationEntity="TestConfiguration" inverseName="user" inverseEntity="TestConfiguration" syncable="YES"/>
<relationship name="logs" optional="YES" toMany="YES" deletionRule="Cascade" ordered="YES" destinationEntity="TestLog" inverseName="user" inverseEntity="TestLog" syncable="YES"/>
</entity>
<elements>
<element name="RootEntity" positionX="0" positionY="0" width="128" height="120"/>
<element name="TestConfiguration" positionX="0" positionY="0" width="128" height="1215"/>
<element name="TestLog" positionX="0" positionY="0" width="128" height="105"/>
<element name="TestLogItem" positionX="0" positionY="0" width="128" height="105"/>
<element name="TestSequence" positionX="0" positionY="0" width="128" height="180"/>
<element name="TestSequenceFolder" positionX="0" positionY="0" width="128" height="90"/>
<element name="TestSequenceImage" positionX="0" positionY="0" width="128" height="135"/>
<element name="User" positionX="0" positionY="0" width="128" height="90"/>
</elements>
</model>
11 changes: 11 additions & 0 deletions PsyPad/Database/Models/TestConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ - (void)installSequence:(NSURL *)sequenceURL name:(NSString *)name data:(NSDicti
background_start = data[@"bg_s"];
}

NSNumber *title_length = nil;
NSNumber *title_start = nil;

if (data[@"t_l"] && data[@"t_s"])
{
title_length = data[@"t_l"];
title_start = data[@"t_s"];
}

NSArray *folders = data[@"g"];
for (NSDictionary *group in [folders sortedArrayUsingComparator:^NSComparisonResult(NSDictionary *a, NSDictionary *b)
{
Expand Down Expand Up @@ -214,6 +223,8 @@ - (void)installSequence:(NSURL *)sequenceURL name:(NSString *)name data:(NSDicti
newSequence.path = sequenceURL.path;
newSequence.background_length = background_length;
newSequence.background_start = background_start;
newSequence.title_length = title_length;
newSequence.title_start = title_start;
[newSequence addFolders:createdFolders];

if (self.sequence)
Expand Down
1 change: 1 addition & 0 deletions PsyPad/Database/Models/TestSequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

- (void)reset;

- (UIImage *)titleImage;
- (UIImage *)backgroundImage;

@end
Loading

0 comments on commit 07c9422

Please sign in to comment.