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 1 commit
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Makes QElement subclasses not depend on the QTableViewCell
  • Loading branch information
escoz committed Jun 10, 2014
commit 05cd05c8250f4fad9b49c3ed1dcdca4b0a11c1b3
2 changes: 1 addition & 1 deletion Classes/Core/QElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
@property(nonatomic, retain) NSString *controllerAction;
@property(nonatomic, retain) NSString *controllerAccessoryAction;

@property(nonatomic, weak) QTableViewCell *currentCell;
@property(nonatomic, weak) UITableViewCell *currentCell;
@property(nonatomic, weak) QuickDialogController *currentController;
@property(nonatomic, weak) QuickDialogTableView *currentTableView;

Expand Down
10 changes: 6 additions & 4 deletions Classes/Core/QElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ - (instancetype)initWithKey:(NSString *)key {

- (UITableViewCell *)getCellForTableView:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller {

QTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[NSString stringWithFormat:@"QD_%@_%@", self.key, self.cellClass]];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[NSString stringWithFormat:@"QD_%@_%@", self.key, self.cellClass]];
if (cell == nil) {
cell = [self createNewCell:tableView];
}
Expand All @@ -57,15 +57,17 @@ - (UITableViewCell *)getCellForTableView:(QuickDialogTableView *)tableView contr
self.currentTableView = tableView;
self.currentController = controller;

[cell applyAppearanceForElement:self];
if ([cell respondsToSelector:@selector(applyAppearanceForElement:)])
[cell performSelector:@selector(applyAppearanceForElement:) withObject:self];

return cell;
}

- (void)setCurrentCell:(QTableViewCell *)currentCell
- (void)setCurrentCell:(UITableViewCell *)currentCell
{
_currentCell = currentCell;
_currentCell.currentElement = self;
if ([_currentCell respondsToSelector:@selector(setCurrentElement:)])
[_currentCell performSelector:@selector(setCurrentElement:) withObject:self];
}


Expand Down
2 changes: 1 addition & 1 deletion Classes/Core/QEmptyListElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ - (instancetype)init {
return self;
}

- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
super.currentCell = cell;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Core/QEntryElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ - (instancetype)initWithTitle:(NSString *)title value:(NSString *)value placehol
}


- (void)setCurrentCell:(QTableViewCell *)qCell
- (void)setCurrentCell:(UITableViewCell *)qCell
{
super.currentCell = qCell;

Expand Down
2 changes: 1 addition & 1 deletion Classes/Core/QLabelElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ -(void)setIconNamed:(NSString *)name {
}


- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
super.currentCell = cell;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Core/QLoadingElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ - (instancetype)init {
return self;
}

- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
super.currentCell = cell;

Expand Down
2 changes: 1 addition & 1 deletion Classes/Core/QRootElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ - (NSUInteger)getVisibleIndexForSection: (QSection*)section
return NSNotFound;
}

- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
[super setCurrentCell:cell];
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Core/QTextElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ - (void)internalInit:(NSString *)text
}


- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
super.currentCell = cell;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Extras/QMailElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ - (instancetype)initWithTitle:(NSString *)title subject:(NSString *)subject mess
return self;
}

- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
super.currentCell = cell;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Extras/QWebElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ -(void)setFile:(NSString *)filename {
_url = [[NSBundle mainBundle] pathForResource:filename ofType:@"html"];
}

- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
super.currentCell = cell;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Forms/QBadgeElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ - (instancetype)initWithTitle:(NSString *)title Value:(NSString *)value {
return self;
}

- (void)setCurrentCell:(QTableViewCell *)currentCell
- (void)setCurrentCell:(UITableViewCell *)currentCell
{
super.currentCell = currentCell;

Expand Down
2 changes: 1 addition & 1 deletion Classes/Forms/QBooleanElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ - (void)setOffImageName:(NSString *)name {
}
}

- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
super.currentCell = cell;
cell.accessoryType = self.sections!= nil ? UITableViewCellAccessoryDisclosureIndicator : UITableViewCellAccessoryNone;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Forms/QButtonElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ - (instancetype)initWithTitle:(NSString *)title {
return self;
}

- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
super.currentCell = cell;
cell.textLabel.text = _title;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Forms/QDateTimeElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ - (instancetype)initWithTitle:(NSString *)title date:(NSDate *)date {
return self;
}

- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
super.currentCell = cell;

Expand Down
2 changes: 1 addition & 1 deletion Classes/Forms/QImageElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ - (void)setImageValueNamed:(NSString *)name {
}
}

- (void)setCurrentCell:(QTableViewCell *)currentCell
- (void)setCurrentCell:(UITableViewCell *)currentCell
{
super.currentCell = currentCell;
QImageTableViewCell *cell = (QImageTableViewCell *) currentCell;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Forms/QMultilineElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ - (instancetype)initWithTitle:(NSString *)title value:(NSString *)text
return self;
}

- (void)setCurrentCell:(QTableViewCell *)currentCell
- (void)setCurrentCell:(UITableViewCell *)currentCell
{
super.currentCell = currentCell;

Expand Down
5 changes: 2 additions & 3 deletions Classes/Forms/QProgressElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ - (void)setProgress:(float)progress
self.bar.progress = progress;
}

- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
self.currentCell = cell;
[cell applyAppearanceForElement:self];
super.currentCell = cell;
cell.selectionStyle = UITableViewCellSelectionStyleNone;

self.bar.frame = CGRectMake(0, 0, cell.contentView.frame.size.width - 60, self.bar.frame.size.height);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Forms/QRadioItemElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ - (instancetype)initWithIndex:(NSUInteger)index RadioSection:(QRadioSection *)se
return self;
}

- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
super.currentCell = cell;
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Forms/QSegmentedElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ - (void)handleSegmentedControlValueChanged:(id)control {
[self handleEditingChanged];
}

- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
super.currentCell = cell;
cell.backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
Expand Down
2 changes: 1 addition & 1 deletion Classes/Forms/QSelectItemElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ -(void)setCheckmarkImageNamed:(NSString *)name {
}
}

- (void)setCurrentCell:(QTableViewCell *)cell
- (void)setCurrentCell:(UITableViewCell *)cell
{
super.currentCell = cell;
cell.selectionStyle = self.enabled ? UITableViewCellSelectionStyleBlue : UITableViewCellSelectionStyleNone;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Forms/QSliderElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ - (void)valueChanged:(UISlider *)slider {
[self handleEditingChanged];
}

- (void)setCurrentCell:(QTableViewCell *)currentCell
- (void)setCurrentCell:(UITableViewCell *)currentCell
{
super.currentCell = currentCell;
QSliderTableViewCell *cell = (QSliderTableViewCell *) currentCell;
Expand Down