# HG changeset patch # User koda # Date 1308689866 -7200 # Node ID 3324e9897ea7b178f21f2ca8d751ad6fdddae22a # Parent 612527a48cd16a7a979d4afbce92de3facfac92c update theme listing for ios diff -r 612527a48cd1 -r 3324e9897ea7 QTfrontend/pageroomslist.cpp --- a/QTfrontend/pageroomslist.cpp Tue Jun 21 22:57:10 2011 +0200 +++ b/QTfrontend/pageroomslist.cpp Tue Jun 21 22:57:46 2011 +0200 @@ -135,7 +135,7 @@ void PageRoomsList::setAdmin(bool flag) { - BtnAdmin->setVisible(flag); + //BtnAdmin->setVisible(flag); } void PageRoomsList::setRoomsList(const QStringList & list) @@ -152,7 +152,7 @@ if(QTableWidgetItem *item = roomsList->item(roomsList->currentRow(), 0)) selection = item->text(); - roomsList->clear(); + //roomsList->clear(); roomsList->setColumnCount(7); roomsList->setHorizontalHeaderLabels( QStringList() << diff -r 612527a48cd1 -r 3324e9897ea7 project_files/HedgewarsMobile/Classes/MapConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Tue Jun 21 22:57:10 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Tue Jun 21 22:57:46 2011 +0200 @@ -380,14 +380,14 @@ -(void) loadDataSourceArray { NSString *model = getModelType(); - // themes.cfg contains all the user-selectable themes - NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"] - encoding:NSUTF8StringEncoding - error:NULL]; - NSMutableArray *themeArray = [[NSMutableArray alloc] initWithArray:[string componentsSeparatedByString:@"\n"]]; - [string release]; - // remove a trailing "" element - [themeArray removeLastObject]; + // only folders containing icon.png are a valid theme + NSArray *themeArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:THEMES_DIRECTORY() error:NULL]; + NSMutableArray *themeArray = [[NSMutableArray alloc] init]; + for (NSString *themeName in themeArrayFull) { + NSString *checkPath = [[NSString alloc] initWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName]; + if ([[NSFileManager defaultManager] fileExistsAtPath:checkPath]) + [themeArray addObject:themeName]; + } // remove images that are too big for certain devices without loading the whole image NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL];