diff --git a/lib/main.dart b/lib/main.dart index bce0f73..fd6dad2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -34,7 +34,7 @@ Future> loadOperatingSystems(bool showUbuntus) async { Tuple5 supportedVersion; if (chunks.length == 4) // Legacy version of quickget { - supportedVersion = Tuple5.fromList([...chunks, "wget"]); + supportedVersion = Tuple5.fromList([...chunks, "curl"]); } else { var t5 = [chunks[0], chunks[1], chunks[2], chunks[3], chunks[4]].toList(); supportedVersion = Tuple5.fromList(t5); diff --git a/lib/src/pages/downloader.dart b/lib/src/pages/downloader.dart index 0afb970..9057c5e 100644 --- a/lib/src/pages/downloader.dart +++ b/lib/src/pages/downloader.dart @@ -31,7 +31,7 @@ class Downloader extends StatefulWidget { class _DownloaderState extends State { final notificationsClient = NotificationsClient(); - final wgetPattern = RegExp("( [0-9.]+%)"); + final curlPattern = RegExp("( [0-9.]+%)"); late final Stream _progressStream; bool _downloadFinished = false; var controller = StreamController(); @@ -43,8 +43,8 @@ class _DownloaderState extends State { super.initState(); } - void parseWgetProgress(String line) { - var matches = wgetPattern.allMatches(line).toList(); + void parseCurlProgress(String line) { + var matches = curlPattern.allMatches(line).toList(); if (matches.isNotEmpty) { var percent = matches[0].group(1); if (percent != null) { @@ -60,9 +60,9 @@ class _DownloaderState extends State { options.add(widget.option!.option); } Process.start('quickget', options).then((process) { - if (widget.option!.downloader == 'wget') { - process.stderr.transform(utf8.decoder).forEach(parseWgetProgress); - } else if (widget.option!.downloader == 'zsync') { + if (widget.option!.downloader != 'zsync') { + process.stderr.transform(utf8.decoder).forEach(parseCurlProgress); + } else { controller.add(-1); } @@ -118,7 +118,7 @@ class _DownloaderState extends State { stream: _progressStream, builder: (context, AsyncSnapshot snapshot) { var data = !snapshot.hasData || - widget.option!.downloader != 'wget' + widget.option!.downloader != 'curl' ? null : snapshot.data; return Column( diff --git a/lib/src/widgets/downloader/download_label.dart b/lib/src/widgets/downloader/download_label.dart index 1cacca1..1c2051b 100644 --- a/lib/src/widgets/downloader/download_label.dart +++ b/lib/src/widgets/downloader/download_label.dart @@ -21,7 +21,7 @@ class DownloadLabel extends StatelessWidget { ? Text(context.t('Download finished.')) : data != null ? downloader != 'zsync' - ? downloader == 'wget' || downloader == 'aria2c' + ? downloader == 'curl' || downloader == '' ? Text(context.t('Downloading... {0}%', args: [(data! * 100).toInt()])) : Text(context.t('{0} Mbs downloaded', args: [data!]))