Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 9 additions & 12 deletions gui/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ class _OpenROMAppState extends State<OpenROMApp> {
localeProvider: widget.localeProvider,
onSettingsChanged:
(format, compression, verify, outputDir, sameFolder, audioCodec) {
setState(() {
_format = format;
_compression = compression;
_verify = verify;
_outputDir = outputDir;
_audioCodec = audioCodec;
});
},
setState(() {
_format = format;
_compression = compression;
_verify = verify;
_outputDir = outputDir;
_audioCodec = audioCodec;
});
},
);

return MaterialApp(
Expand Down Expand Up @@ -174,10 +174,7 @@ class _OpenROMAppState extends State<OpenROMApp> {
child: IndexedStack(
index: _selectedIndex,
children: [
HomeScreen(
theme: theme,
controller: _homeController,
),
HomeScreen(theme: theme, controller: _homeController),
PatcherScreen(theme: theme),
ToolsScreen(theme: theme),
DreamcastScreen(theme: theme),
Expand Down
13 changes: 5 additions & 8 deletions gui/lib/controllers/home_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ class HomeController extends ChangeNotifier {
final roms = await FileDetector.detectPaths(paths);
for (final rom in roms) {
if (!_jobs.any((j) => j.romFile.filepath == rom.filepath)) {
final defaultTarget =
rom.validTargets.isNotEmpty ? rom.validTargets.first : 'CHD';
final defaultTarget = rom.validTargets.isNotEmpty
? rom.validTargets.first
: 'CHD';
_jobs.add(
ConversionJob(
id: DateTime.now().microsecondsSinceEpoch.toString(),
Expand All @@ -58,9 +59,7 @@ class HomeController extends ChangeNotifier {
}
}

void pickFiles({
void Function(OpenROMException e)? onError,
}) async {
void pickFiles({void Function(OpenROMException e)? onError}) async {
final result = await FilePicker.platform.pickFiles(
allowMultiple: true,
type: FileType.any,
Expand Down Expand Up @@ -156,9 +155,7 @@ class HomeController extends ChangeNotifier {
job.status = JobStatus.failed;
job.error = e.error;
job.errorMessage = e.details ?? e.error.message;
_logs.add(
'[ERROR] ${e.error.title}: ${e.details ?? e.error.message}',
);
_logs.add('[ERROR] ${e.error.title}: ${e.details ?? e.error.message}');
notifyListeners();
if (onError != null) {
onError(e);
Expand Down
56 changes: 33 additions & 23 deletions gui/lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'app_localizations_pt.dart';
import 'app_localizations_ru.dart';
import 'app_localizations_tr.dart';
import 'app_localizations_zh.dart';
import 'app_localizations_zh_TW.dart';

// ignore_for_file: type=lint

Expand Down Expand Up @@ -72,7 +73,7 @@ import 'app_localizations_zh.dart';
/// property.
abstract class AppLocalizations {
AppLocalizations(String locale)
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
: localeName = intl.Intl.canonicalizedLocale(locale.toString());

final String localeName;

Expand All @@ -95,11 +96,11 @@ abstract class AppLocalizations {
/// of delegates is preferred or required.
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
<LocalizationsDelegate<dynamic>>[
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
];
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
];

/// A list of this localizations delegate's supported locales.
static const List<Locale> supportedLocales = <Locale>[
Expand All @@ -113,7 +114,8 @@ abstract class AppLocalizations {
Locale('pt'),
Locale('ru'),
Locale('tr'),
Locale('zh')
Locale('zh'),
Locale('zh_TW'),
];

/// No description provided for @appTitle.
Expand Down Expand Up @@ -998,18 +1000,18 @@ class _AppLocalizationsDelegate

@override
bool isSupported(Locale locale) => <String>[
'ar',
'de',
'en',
'es',
'fr',
'it',
'ja',
'pt',
'ru',
'tr',
'zh'
].contains(locale.languageCode);
'ar',
'de',
'en',
'es',
'fr',
'it',
'ja',
'pt',
'ru',
'tr',
'zh',
].contains(locale.languageCode);

@override
bool shouldReload(_AppLocalizationsDelegate old) => false;
Expand Down Expand Up @@ -1039,12 +1041,20 @@ AppLocalizations lookupAppLocalizations(Locale locale) {
case 'tr':
return AppLocalizationsTr();
case 'zh':
if (locale.countryCode == 'TW' ||
locale.countryCode == 'HK' ||
locale.countryCode == 'MO') {
return AppLocalizationsZhTw();
}
return AppLocalizationsZh();
case 'zh_TW':
return AppLocalizationsZhTw();
}

throw FlutterError(
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.');
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.',
);
}
Loading
Loading