Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0 #738

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open

2.0 #738

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
39 changes: 0 additions & 39 deletions AppledocSettings.plist

This file was deleted.

Binary file added Assets/Core/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Core/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# QuickDialog CHANGELOG

## 0.1.0

Initial release.
22 changes: 22 additions & 0 deletions Classes/Core/NSMutableArray+MoveObject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// Copyright 2011 ESCOZ Inc - http://escoz.com
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
// ANY KIND, either express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//
//

#import <Foundation/Foundation.h>

@interface NSMutableArray (MoveObject)

- (void)qd_moveObjectFromIndex:(NSUInteger)from toIndex:(NSUInteger)to;

@end
33 changes: 33 additions & 0 deletions Classes/Core/NSMutableArray+MoveObject.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// Copyright 2011 ESCOZ Inc - http://escoz.com
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
// ANY KIND, either express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//

#import "NSMutableArray+MoveObject.h"

@implementation NSMutableArray (MoveObject)

- (void)qd_moveObjectFromIndex:(NSUInteger)from toIndex:(NSUInteger)to
{
if (to == from)
return;

id objectToMove = self[from];
[self removeObjectAtIndex:from];
if (to >= [self count]) {
[self addObject:objectToMove];
} else {
[self insertObject:objectToMove atIndex:to];
}
}
@end

21 changes: 19 additions & 2 deletions quickdialog/QAppearance.h → Classes/Core/QAppearance.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
//
// Copyright 2011 ESCOZ Inc - http://escoz.com
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
// ANY KIND, either express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//

#import <Foundation/Foundation.h>

@class QSection;
@class QuickDialogTableView;
@class QElement;


@interface QAppearance : NSObject<NSCopying>

@property(nonatomic, strong) UIColor *labelColorDisabled;
@property (nonatomic,strong) UIColor *labelColorEnabled;
@property (nonatomic,strong) UIFont *labelFont;
@property (nonatomic,strong) UIFont *titleFont;
@property (nonatomic,strong)UIColor * backgroundColorEnabled;
@property (nonatomic,strong)UIColor * backgroundColorDisabled;
@property (nonatomic) NSTextAlignment labelAlignment;
Expand All @@ -32,7 +50,6 @@
@property(nonatomic, strong) UIView *selectedBackgroundView;
@property(nonatomic, strong) UIColor *sectionTitleShadowColor;
@property(nonatomic) BOOL toolbarTranslucent;
@property(nonatomic) CGFloat cellBorderWidth;
@property(nonatomic) NSNumber * defaultHeightForHeader;
@property(nonatomic) NSNumber * defaultHeightForFooter;

Expand Down
31 changes: 19 additions & 12 deletions quickdialog/QAppearance.m → Classes/Core/QAppearance.m
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
//
// Copyright 2011 ESCOZ Inc - http://escoz.com
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
// ANY KIND, either express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//

#import "QAppearance.h"
#import "QSection.h"
#import "QElement.h"

@implementation QAppearance {

}

@synthesize sectionTitleFont = _sectionTitleFont;
@synthesize sectionTitleColor = _sectionTitleColor;
@synthesize sectionFooterFont = _sectionFooterFont;
@synthesize sectionFooterColor = _sectionFooterColor;
@synthesize entryAlignment = _entryAlignment;
@synthesize buttonAlignment = _buttonAlignment;
@synthesize selectedBackgroundView = _selectedBackgroundView;
@synthesize sectionTitleShadowColor = _sectionTitleShadowColor;


- (QAppearance *)init {
- (instancetype)init {
self = [super init];
if (self) {
[self setDefaults];
Expand All @@ -34,7 +41,7 @@ - (id)copyWithZone:(NSZone *)zone {
copy.actionColorDisabled = _actionColorDisabled;
copy.actionColorEnabled = _actionColorEnabled;

copy.labelFont = _labelFont;
copy.titleFont = _titleFont;
copy.labelAlignment = _labelAlignment;

copy.backgroundColorDisabled = _backgroundColorDisabled;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#import "QBindingEvaluator.h"
#import "QuickDialog.h"
#import "QTextElement.h"

@interface QBindingEvaluator ()
+ (BOOL)stringIsEmpty:(NSString *)aString;
Expand All @@ -24,7 +25,7 @@ @implementation QBindingEvaluator {
QRootBuilder *_builder;
}

- (id)init {
- (instancetype)init {
self = [super init];
if (self) {
_builder = [QRootBuilder new];
Expand All @@ -50,8 +51,8 @@ - (void)bindObject:(id)object toData:(id)data withString:string {
for (NSString *each in [string componentsSeparatedByString:@","]) {
NSArray *bindingParams = [each componentsSeparatedByString:@":"];

NSString *propName = [((NSString *) [bindingParams objectAtIndex:0]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *valueName = [((NSString *) [bindingParams objectAtIndex:1]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *propName = [((NSString *) bindingParams[0]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *valueName = [((NSString *) bindingParams[1]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

if ([propName isEqualToString:@"iterate"] && [object isKindOfClass:[QSection class]]) {
[self bindSection:(QSection *)object toCollection:[@"self" isEqualToString:valueName] ? data : [data valueForKeyPath:valueName]];
Expand All @@ -78,10 +79,7 @@ + (BOOL)stringIsEmpty:(NSString *) aString {
return YES;
}
aString = [aString stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
if ([aString length] == 0) {
return YES;
}
return NO;
return [aString length] == 0;
}

- (void)bindSection:(QSection *)section toCollection:(NSArray *)items {
Expand Down Expand Up @@ -128,7 +126,7 @@ - (void)bindSection:(QSection *)section toProperties:(NSDictionary *)object {
for (id item in [object allKeys]){
QElement *element = [_builder buildElementWithObject:section.elementTemplate];
[section addElement:element];
[element bindToObject:[NSDictionary dictionaryWithObjectsAndKeys:item, @"key", [object valueForKey:item], @"value", nil]];
[element bindToObject:@{@"key" : item, @"value" : [object valueForKey:item]}];
}
}

Expand All @@ -140,8 +138,8 @@ - (void)fetchValueFromObject:(QElement *)element toData:(id)data {
for (NSString *each in [element.bind componentsSeparatedByString:@","])
{
NSArray *bindingParams = [each componentsSeparatedByString:@":"];
NSString *propName = [((NSString *) [bindingParams objectAtIndex:0]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *valueName = [((NSString *) [bindingParams objectAtIndex:1]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *propName = [((NSString *) bindingParams[0]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *valueName = [((NSString *) bindingParams[1]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

if (![propName isEqualToString:@"iterate"] && ![valueName isEqualToString:@"self"]) {
@try {
Expand Down
26 changes: 26 additions & 0 deletions Classes/Core/QDynamicDataSection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Copyright 2011 ESCOZ Inc - http://escoz.com
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
// ANY KIND, either express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//

#import <Foundation/Foundation.h>

#import "QSection.h"
@interface QDynamicDataSection : QSection {



}
@property(nonatomic, strong) NSString *emptyMessage;


@end
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
//
// Copyright 2011 ESCOZ Inc - http://escoz.com
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
// ANY KIND, either express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//


#import "QDynamicDataSection.h"
#import "QuickDialog.h"
#import "QEmptyListElement.h"

@implementation QDynamicDataSection {
NSString *_emptyMessage;
BOOL showLoading;
}
@synthesize emptyMessage = _emptyMessage;


- (QDynamicDataSection *)init {
- (instancetype)init {
self = [super init];
if (self) {
_emptyMessage = @"Empty";
Expand All @@ -32,8 +44,8 @@ - (void)bindToObject:(id)data withString:(NSString *)withBindString

for (NSString *each in [self.bind componentsSeparatedByString:@","]) {
NSArray *bindingParams = [each componentsSeparatedByString:@":"];
NSString *propName = [((NSString *) [bindingParams objectAtIndex:0]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *valueName = [((NSString *) [bindingParams objectAtIndex:1]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *propName = [((NSString *) bindingParams[0]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *valueName = [((NSString *) bindingParams[1]) stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

if ([propName isEqualToString:@"iterate"]) {
collection = [data valueForKeyPath:valueName];
Expand Down
29 changes: 29 additions & 0 deletions Classes/Core/QElement+Appearance.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// Copyright 2011 ESCOZ Inc - http://escoz.com
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
// ANY KIND, either express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//


#import <Foundation/Foundation.h>
#import "QElement.h"

@class QAppearance;

@interface QElement (Appearance)

@property(nonatomic, retain) QAppearance *appearance;

+ (QAppearance *)appearance;
+ (void)setAppearance:(QAppearance *)newAppearance;


@end
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
//
// Copyright 2011 ESCOZ Inc - http://escoz.com
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
// ANY KIND, either express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//


#import <objc/runtime.h>
#import "QElement+Appearance.h"
#import "QClassicAppearance.h"
#import "QSection.h"
#import "QRootElement+JsonBuilder.h"
#import "QFlatAppearance.h"


static void * const KEY_APPEARANCE_OBJECT = (void*)&KEY_APPEARANCE_OBJECT;
Expand All @@ -14,11 +31,7 @@ + (QAppearance *)appearance {
appearance = [[self class].superclass appearance];
}
if (appearance==nil) {
#if __IPHONE_7_0
appearance = [[[UIDevice currentDevice] systemVersion] floatValue]>=7.f ? [QFlatAppearance new] : [QClassicAppearance new];
#else
appearance = [QClassicAppearance new];
#endif
appearance = [QFlatAppearance new];
[self setAppearance:appearance];
}
return appearance;
Expand Down
Loading