From 841e8d1bb50bb6398fe5b3a0afafeb7d43c37527 Mon Sep 17 00:00:00 2001 From: meancoot Date: Fri, 7 Jun 2013 10:38:13 -0400 Subject: [PATCH] (iOS) Tapping a firmware item in RAModuleInfo will display an alert view with the full path --- ios/RetroArch/RAModuleInfo.m | 15 +++++++++++++-- ios/RetroArch/RetroArch_iOS.h | 1 + ios/RetroArch/browser/RAModuleList.m | 5 +++-- ios/RetroArch/main.m | 7 ++++++- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ios/RetroArch/RAModuleInfo.m b/ios/RetroArch/RAModuleInfo.m index ed9fb4088a..56d0ed2a85 100644 --- a/ios/RetroArch/RAModuleInfo.m +++ b/ios/RetroArch/RAModuleInfo.m @@ -165,14 +165,25 @@ static NSString* get_data_string(config_file_t* config, const char* name, NSStri return ([_sections[section] count] - 1) / 2; } +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (indexPath.section == _firmwareSectionIndex) + [RetroArch_iOS displayErrorMessage:_sections[indexPath.section][indexPath.row * 2 + 2] withTitle:_sections[indexPath.section][indexPath.row * 2 + 1]]; +} + - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell* cell = [self.tableView dequeueReusableCellWithIdentifier:@"datacell"]; - cell = (cell != nil) ? cell : [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"datacell"]; + + if (!cell) + { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"datacell"]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.detailTextLabel.adjustsFontSizeToFitWidth = YES; + } cell.textLabel.text = _sections[indexPath.section][indexPath.row * 2 + 1]; cell.detailTextLabel.text = _sections[indexPath.section][indexPath.row * 2 + 2]; - cell.detailTextLabel.adjustsFontSizeToFitWidth = YES; if (indexPath.section == _firmwareSectionIndex) cell.backgroundColor = ra_ios_is_file(_sections[indexPath.section][indexPath.row * 2 + 2]) ? [UIColor blueColor] : [UIColor redColor]; diff --git a/ios/RetroArch/RetroArch_iOS.h b/ios/RetroArch/RetroArch_iOS.h index 1a8f5c0521..57c2bfeb56 100644 --- a/ios/RetroArch/RetroArch_iOS.h +++ b/ios/RetroArch/RetroArch_iOS.h @@ -18,6 +18,7 @@ @interface RetroArch_iOS : UINavigationController + (void)displayErrorMessage:(NSString*)message; ++ (void)displayErrorMessage:(NSString*)message withTitle:(NSString*)title; + (RetroArch_iOS*)get; diff --git a/ios/RetroArch/browser/RAModuleList.m b/ios/RetroArch/browser/RAModuleList.m index 24bca4f2fb..ea18dac26d 100644 --- a/ios/RetroArch/browser/RAModuleList.m +++ b/ios/RetroArch/browser/RAModuleList.m @@ -87,9 +87,10 @@ - (void)infoButtonTapped:(id)sender { RAModuleInfo* info = objc_getAssociatedObject(sender, "MODULE"); - - if (info) + if (info && info.data) [RetroArch_iOS.get pushViewController:[[RAModuleInfoList alloc] initWithModuleInfo:info] animated:YES]; + else + [RetroArch_iOS displayErrorMessage:@"No information available."]; } - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath diff --git a/ios/RetroArch/main.m b/ios/RetroArch/main.m index 430e6d4212..a4af4450d0 100644 --- a/ios/RetroArch/main.m +++ b/ios/RetroArch/main.m @@ -223,7 +223,12 @@ static void event_reload_config(void* userdata) + (void)displayErrorMessage:(NSString*)message { - UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"RetroArch" + [RetroArch_iOS displayErrorMessage:message withTitle:@"RetroArch"]; +} + ++ (void)displayErrorMessage:(NSString*)message withTitle:(NSString*)title +{ + UIAlertView* alert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"OK"