From b95d928135a8dafde003af98a0a36df627e6f3c2 Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Thu, 16 Dec 2021 21:39:13 +0100 Subject: [PATCH 01/26] Updated Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f9b6926..2dcb3e5 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ BASE_NAME := quickgui-$(VERSION) BUILD_DIR := $(BUILD_ROOT)/$(BASE_NAME) BIN_TAR := $(BUILD_ROOT)/$(BASE_NAME).tar SRC_TAR := $(BUILD_ROOT)/$(BASE_NAME)-src.tar -FLUTTER := /usr/local/bin/flutter +FLUTTER := /opt/flutter/bin/flutter all: version bin From 75cfc5c13b1ea0daf677f867c1135e994bd4087a Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Thu, 16 Dec 2021 21:46:18 +0100 Subject: [PATCH 02/26] Fix: black screen on startup When user preferences did not exist, there was a chance to get a black screen on startup. --- lib/src/app.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/src/app.dart b/lib/src/app.dart index acfd85b..5f32950 100644 --- a/lib/src/app.dart +++ b/lib/src/app.dart @@ -32,8 +32,10 @@ class _AppState extends State with PreferencesMixin { appSettings.setActiveLocaleSilently( snapshot.data?.getString(prefCurrentLocale) ?? Platform.localeName); - appSettings.useDarkModeSilently = - snapshot.data!.getBool(prefThemeMode) as bool; + var pref = snapshot.data!.getBool(prefThemeMode); + if (pref != null) { + appSettings.useDarkModeSilently = pref; + } return Consumer( builder: (context, appSettings, _) => MaterialApp( theme: ThemeData(primarySwatch: Colors.pink), From 757c035010cabc245739fa826c59d4e56af6bc1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Sim=C3=B5es?= <16106645+Ricardo-Simoes@users.noreply.github.com> Date: Thu, 16 Dec 2021 20:47:46 +0000 Subject: [PATCH 03/26] Added Portuguese European (pt_PT) translation (#55) * added 'pt_PT' translation Added pt_PT (Portuguese European) translation * Added pt_PT locale to supported_locales.dart --- assets/i18n/pt_PT.po | 131 +++++++++++++++++++++++++++++++++ lib/src/supported_locales.dart | 1 + 2 files changed, 132 insertions(+) create mode 100644 assets/i18n/pt_PT.po diff --git a/assets/i18n/pt_PT.po b/assets/i18n/pt_PT.po new file mode 100644 index 0000000..863e106 --- /dev/null +++ b/assets/i18n/pt_PT.po @@ -0,0 +1,131 @@ +msgid "" +msgstr "" +"Project-Id-Version: quickgui\n" +"POT-Creation-Date: 2021-09-29 09:59+0200\n" +"PO-Revision-Date: 2021-12-16 16:53+0000\n" +"Last-Translator: Ricardo Simões - XM Corporation \n" +"Language-Team: Ricardo Simões - XM Corporation\n" +"Language: pt_PT\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.0\n" +"X-Poedit-Basepath: .\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgid "Quickgui : a Flutter frontend for Quickget and Quickemu" +msgstr "Quickgui: um interface gráfico feito em Flutter para Quickget e Quickemu" + +msgid "Main menu" +msgstr "Menu principal" + +msgid "Use dark mode" +msgstr "Usar modo escuro" + +msgid "Cancel" +msgstr "Cancelar" + +msgid "Click to use SPICE display" +msgstr "Clique para usar mostrador SPICE" + +msgid "Create new machines" +msgstr "Criar novas máquinas" + +msgid "Dismiss" +msgstr "Dispensar" + +msgid "Done !" +msgstr "Feito !" + +msgid "Download" +msgstr "Transferir" + +msgid "Download finished." +msgstr "Transferência terminada." + +msgid "Downloader" +msgstr "Transferidor" + +msgid "Downloading (no progress available)..." +msgstr "A transferir (progresso não disponível)..." + +msgid "Downloading...{0}%" +msgstr "A transferir...{0}%" + +msgid "Downloading {0}" +msgstr "A transferir {0}" + +msgid "Download cancelled" +msgstr "Transferência cancelada" + +msgid "Download complete" +msgstr "Transferência completada" + +msgid "Download of {0} has completed." +msgstr "Transferência de {0} completou." + +msgid "Manage existing machines" +msgstr "Gerir máquinas existentes" + +msgid "Manager" +msgstr "Gestor" + +msgid "{0} Mbs downloaded" +msgstr "{0} Mbs transferidos" + +msgid "Now run {0} to start the VM" +msgstr "Agora corra {0} para iniciar a VM" + +msgid "OK" +msgstr "OK" + +msgid "Operating system" +msgstr "Sistema operativo" + +msgid "Search operating system" +msgstr "Procurar sistema operativo" + +msgid "Search option" +msgstr "Opção de pesquisa" + +msgid "Select operating system" +msgstr "Selecione sistema operativo" + +msgid "Select option" +msgstr "Selecione opção" + +msgid "Select version for {0}" +msgstr "Selecione versão para {0}" + +msgid "Select..." +msgstr "Selecione..." + +msgid "SPICE port" +msgstr "Porto SPICE" + +msgid "SSH port" +msgstr "Porto SSH" + +msgid "Stop The Virtual Machine?" +msgstr "Parar a Máquina Virtual?" + +msgid "Target folder : {0}" +msgstr "Pasta alvo : {0}" + +msgid "Use SPICE display" +msgstr "Usar mostrador SPICE" + +msgid "Using SPICE display" +msgstr "A usar mostrador SPICE" + +msgid "Version" +msgstr "Versão" + +msgid "Waiting for download to start" +msgstr "A aguardar que a transferência comece" + +msgid "You are about to terminate the virtual machine {0}" +msgstr "Está prestes a pôr termo à máquina virtual {0}" + +msgid "Language" +msgstr "Idioma" diff --git a/lib/src/supported_locales.dart b/lib/src/supported_locales.dart index c826447..a9cdb79 100644 --- a/lib/src/supported_locales.dart +++ b/lib/src/supported_locales.dart @@ -27,5 +27,6 @@ final supportedLocales = [ 'nl', 'no', //'oc', + 'pt_PT', 'ru', ]; From 93a9fb45e5f311daa36d245b57c952fe35bd3089 Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Thu, 16 Dec 2021 22:17:08 +0100 Subject: [PATCH 04/26] Bumped version number --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 83ce89c..0cd0da5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.1.9 +version: 1.2.0 environment: sdk: ">=2.14.4 <3.0.0" From ad4081262d16d76df71614962a6524e6d5af3db3 Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Fri, 17 Dec 2021 12:26:58 +0100 Subject: [PATCH 05/26] Testing my push rights. --- BUILDING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILDING.md b/BUILDING.md index 7867318..5dd7e93 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -1 +1 @@ -flutter pub add window_size --git-url git://github.com/google/flutter-desktop-embedding.git --git-path plugins/window_size +flutter pub add window_size --git-url git://github.com/google/flutter-desktop-embedding.git --git-path plugins/window_size \ No newline at end of file From 615ed5730c9fd474c4f2c7bd346f00c00d192cb7 Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Fri, 17 Dec 2021 22:32:26 +0100 Subject: [PATCH 06/26] Housekeeping --- .gitignore | 2 ++ BUILDING.md | 1 - RELEASING.md | 23 ----------------------- 3 files changed, 2 insertions(+), 24 deletions(-) delete mode 100644 BUILDING.md delete mode 100644 RELEASING.md diff --git a/.gitignore b/.gitignore index 0b6607d..3f1b889 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,5 @@ list.csv *.iso *.conf *.mo +RELEASING.md +BUILDING.md diff --git a/BUILDING.md b/BUILDING.md deleted file mode 100644 index 5dd7e93..0000000 --- a/BUILDING.md +++ /dev/null @@ -1 +0,0 @@ -flutter pub add window_size --git-url git://github.com/google/flutter-desktop-embedding.git --git-path plugins/window_size \ No newline at end of file diff --git a/RELEASING.md b/RELEASING.md deleted file mode 100644 index ff2ba4c..0000000 --- a/RELEASING.md +++ /dev/null @@ -1,23 +0,0 @@ -* bump the version number in pubspec.yaml (ex: version: 1.0.5) -* push to github -* create and push version tag (ex: v1.0.5) -* create a release on GitHub -* build the tarball (`make`) -* upload the tarball to github - -* `cd /mnt/data/dev/debianpackages/quickgui.deb/quickgui` -* `head debian/changelog` to check the latest changelog -* `dch -v a.b.c "New changelog message"` -* `nano debian/changelog` to change the release (ex: 1.0.5-1~focal1.0 focal) -* `uscan --noconf --force-download --rename --download-current-version --destdir=.. --verbose` to download the tarball properly -* `dpkg-buildpackage -d -S -sa` to build the changes file (the name of the key to use is in ~/.config/dpkg/buildpackage.conf) -* `nano debian/changelog` to change the release (ex: 1.0.5-1~hirsute1.0 hirsute) -* `dpkg-buildpackage -d -S -sa` -* `nano debian/changelog` to change the release (ex: 1.0.5-1~impish1.0 impish) -* `dpkg-buildpackage -d -S -sa` -* `nano debian/changelog` to change the release (ex: 1.0.5-1~jammy.0 jammy) -* `dpkg-buildpackage -d -S -sa` -* `dput ppa:yannick-mauray/quickgui ../quickgui_1.0.5-1~focal1.0_source.changes` -* `dput ppa:yannick-mauray/quickgui ../quickgui_1.0.5-1~hirsute1.0_source.changes` -* `dput ppa:yannick-mauray/quickgui ../quickgui_1.0.5-1~impish1.0_source.changes` -* `dput ppa:yannick-mauray/quickgui ../quickgui_1.0.5-1~jammy1.0_source.changes` From a53c6c3ffc6e2c1ec4005711f8864b5a18290350 Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Fri, 17 Dec 2021 23:36:02 +0100 Subject: [PATCH 07/26] Bumped version number. --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 0cd0da5..bc97ca2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.2.0 +version: 1.2.1 environment: sdk: ">=2.14.4 <3.0.0" From 326a39bbf46300610427f3e111436689b5514725 Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Sat, 18 Dec 2021 23:58:51 +0100 Subject: [PATCH 08/26] Added : quickemu-icons submodule --- assets/quickemu-icons | 1 + pubspec.yaml | 1 + 2 files changed, 2 insertions(+) create mode 160000 assets/quickemu-icons diff --git a/assets/quickemu-icons b/assets/quickemu-icons new file mode 160000 index 0000000..6752bd8 --- /dev/null +++ b/assets/quickemu-icons @@ -0,0 +1 @@ +Subproject commit 6752bd8340b72db978ebe04abc506eb404e10cc7 diff --git a/pubspec.yaml b/pubspec.yaml index bc97ca2..0b93723 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -83,6 +83,7 @@ flutter: assets: - assets/images/ - assets/i18n/ + - assets/quickemu-icons/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. From eedd30a5c8e5d341a4c6b0c375ccf23487311b4f Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Sun, 19 Dec 2021 01:11:09 +0100 Subject: [PATCH 09/26] Fixed : missing padding --- lib/src/pages/version_selection.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/src/pages/version_selection.dart b/lib/src/pages/version_selection.dart index 940f046..51aa03d 100644 --- a/lib/src/pages/version_selection.dart +++ b/lib/src/pages/version_selection.dart @@ -27,6 +27,7 @@ class _VersionSelectionState extends State { child: Column( children: [ ListView.builder( + padding: const EdgeInsets.only(top: 4), shrinkWrap: true, itemCount: widget.operatingSystem.versions.length, itemBuilder: (context, index) { From 101b6f1dc743d24180b60c52f9e20b4c89eac2fc Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Sun, 19 Dec 2021 01:16:05 +0100 Subject: [PATCH 10/26] Added : distro icons in the download manager. --- lib/src/pages/operating_system_selection.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/src/pages/operating_system_selection.dart b/lib/src/pages/operating_system_selection.dart index 9aa9709..4506604 100644 --- a/lib/src/pages/operating_system_selection.dart +++ b/lib/src/pages/operating_system_selection.dart @@ -1,4 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/parser.dart'; +import 'package:flutter_svg/svg.dart'; import 'package:gettext_i18n/gettext_i18n.dart'; import '../model/operating_system.dart'; @@ -69,9 +72,15 @@ class _OperatingSystemSelectionState extends State { itemCount: list.length, itemBuilder: (context, index) { var item = list[index]; + var icon = SvgPicture.asset( + "assets/quickemu-icons/${item.code}-quickemu-white-pinkbg.svg", + width: 32, + height: 32, + ); return Card( child: ListTile( title: Text(item.name), + leading: icon, onTap: () { Navigator.of(context).pop(item); }, From d0f65e1799766288ebb9d14a438e40ccaa328a62 Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Sun, 19 Dec 2021 01:24:21 +0100 Subject: [PATCH 11/26] Fixing submodule mess --- assets/quickemu-icons | 1 - 1 file changed, 1 deletion(-) delete mode 160000 assets/quickemu-icons diff --git a/assets/quickemu-icons b/assets/quickemu-icons deleted file mode 160000 index 6752bd8..0000000 --- a/assets/quickemu-icons +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6752bd8340b72db978ebe04abc506eb404e10cc7 From 13f94a57493e08bf4db6df9f615115c9b9cce682 Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Sun, 19 Dec 2021 01:28:09 +0100 Subject: [PATCH 12/26] Fixed : actually fixing submodules mess --- .gitmodules | 4 ++++ assets/quickemu-icons | 1 + 2 files changed, 5 insertions(+) create mode 100644 .gitmodules create mode 160000 assets/quickemu-icons diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8c3bb03 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "assets/quickemu-icons"] + path = assets/quickemu-icons + url = https://github.com/quickemu-project/quickemu-icons.git + branch = quickgui diff --git a/assets/quickemu-icons b/assets/quickemu-icons new file mode 160000 index 0000000..6752bd8 --- /dev/null +++ b/assets/quickemu-icons @@ -0,0 +1 @@ +Subproject commit 6752bd8340b72db978ebe04abc506eb404e10cc7 From acc304566b2e183d9d57636e92829a37bc9d7baa Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Sun, 19 Dec 2021 01:51:59 +0100 Subject: [PATCH 13/26] Added : don't embed the png distro icons --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2dcb3e5..fe3419c 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ bin: quickgui mkdir -p $(BUILD_DIR) cp -a build/linux/x64/release/bundle/* $(BUILD_DIR) cp -a assets/resources $(BUILD_DIR) - tar -C $(BUILD_ROOT) -c -v -f $(BIN_TAR) $(BASE_NAME) + tar -C $(BUILD_ROOT) -c -v --exclude "quickemu-icons/*.png" -f $(BIN_TAR) $(BASE_NAME) xz -z $(BIN_TAR) src: From 56cadacd4a947aadc0484331d14b0cd7b17bbdec Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Sun, 19 Dec 2021 01:52:35 +0100 Subject: [PATCH 14/26] Bumped version number --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 0b93723..9fe2dca 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.2.1 +version: 1.2.2 environment: sdk: ">=2.14.4 <3.0.0" From 0837bf9d80b335b0758f25f6874cb2676a1c3f17 Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Tue, 21 Dec 2021 22:17:04 +0100 Subject: [PATCH 15/26] Source code formated at 80 columns. --- lib/src/pages/downloader.dart | 24 +++- lib/src/pages/main_page.dart | 3 +- lib/src/pages/manager.dart | 129 +++++++++++------- lib/src/pages/operating_system_selection.dart | 10 +- lib/src/pages/option_selection.dart | 7 +- lib/src/pages/version_selection.dart | 22 ++- .../downloader/cancel_dismiss_button.dart | 8 +- .../widgets/downloader/download_label.dart | 10 +- .../widgets/home_page/home_page_button.dart | 9 +- .../home_page/home_page_button_group.dart | 47 +++++-- lib/src/widgets/home_page/main_menu.dart | 10 +- 11 files changed, 189 insertions(+), 90 deletions(-) diff --git a/lib/src/pages/downloader.dart b/lib/src/pages/downloader.dart index ac0d381..a723588 100644 --- a/lib/src/pages/downloader.dart +++ b/lib/src/pages/downloader.dart @@ -77,7 +77,9 @@ class _DownloaderState extends State { } else if (widget.option!.downloader == 'zsync') { controller.add(-1); } else if (widget.option!.downloader == 'macrecovery') { - process.stdout.transform(utf8.decoder).forEach(parseMacRecoveryProgress); + process.stdout + .transform(utf8.decoder) + .forEach(parseMacRecoveryProgress); } process.exitCode.then((value) { @@ -86,7 +88,9 @@ class _DownloaderState extends State { setState(() { _downloadFinished = true; notificationsClient.notify( - _cancelled ? context.t('Download cancelled') : context.t('Download complete'), + _cancelled + ? context.t('Download cancelled') + : context.t('Download complete'), body: _cancelled ? context.t( 'Download of {0} has completed.', @@ -111,8 +115,12 @@ class _DownloaderState extends State { return Scaffold( appBar: AppBar( title: Text( - context.t('Downloading {0}', - args: ['${widget.operatingSystem.name} ${widget.version.version}' + (widget.option!.option.isNotEmpty ? ' (${widget.option!.option})' : '')]), + context.t('Downloading {0}', args: [ + '${widget.operatingSystem.name} ${widget.version.version}' + + (widget.option!.option.isNotEmpty + ? ' (${widget.option!.option})' + : '') + ]), ), automaticallyImplyLeading: false, ), @@ -122,7 +130,10 @@ class _DownloaderState extends State { child: StreamBuilder( stream: _progressStream, builder: (context, AsyncSnapshot snapshot) { - var data = !snapshot.hasData || widget.option!.downloader != 'wget' ? null : snapshot.data; + var data = + !snapshot.hasData || widget.option!.downloader != 'wget' + ? null + : snapshot.data; return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -137,7 +148,8 @@ class _DownloaderState extends State { ), Padding( padding: const EdgeInsets.only(top: 32), - child: Text(context.t('Target folder : {0}', args: [Directory.current.path])), + child: Text(context.t('Target folder : {0}', + args: [Directory.current.path])), ), ], ); diff --git a/lib/src/pages/main_page.dart b/lib/src/pages/main_page.dart index 61c66ed..ca0c469 100644 --- a/lib/src/pages/main_page.dart +++ b/lib/src/pages/main_page.dart @@ -17,7 +17,8 @@ class _MainPageState extends State { @override void didChangeDependencies() { super.didChangeDependencies(); - setWindowTitle(context.t('Quickgui : a Flutter frontend for Quickget and Quickemu')); + setWindowTitle( + context.t('Quickgui : a Flutter frontend for Quickget and Quickemu')); } @override diff --git a/lib/src/pages/manager.dart b/lib/src/pages/manager.dart index 082702e..897b2fc 100644 --- a/lib/src/pages/manager.dart +++ b/lib/src/pages/manager.dart @@ -61,7 +61,8 @@ class _ManagerState extends State with PreferencesMixin { } Directory.current = pref; }); - Future.delayed(Duration.zero, () => _getVms(context)); // Reload VM list when we enter the page. + Future.delayed(Duration.zero, + () => _getVms(context)); // Reload VM list when we enter the page. }); refreshTimer = Timer.periodic(const Duration(seconds: 5), (Timer t) { _getVms(context); @@ -78,7 +79,8 @@ class _ManagerState extends State with PreferencesMixin { // Find out which terminal emulator we have set as the default. ProcessResult result = await Process.run('which', ['x-terminal-emulator']); if (result.exitCode == 0) { - String terminalEmulator = await File(result.stdout.toString().trim()).resolveSymbolicLinks(); + String terminalEmulator = + await File(result.stdout.toString().trim()).resolveSymbolicLinks(); terminalEmulator = path.basenameWithoutExtension(terminalEmulator); if (_supportedTerminalEmulators.contains(terminalEmulator)) { setState(() { @@ -130,7 +132,8 @@ class _ManagerState extends State with PreferencesMixin { List currentVms = []; Map activeVms = {}; - await for (var entity in Directory.current.list(recursive: false, followLinks: true)) { + await for (var entity + in Directory.current.list(recursive: false, followLinks: true)) { if ((entity.path.endsWith('.conf')) && (_isValidConf(entity.path))) { String name = path.basenameWithoutExtension(entity.path); currentVms.add(name); @@ -169,7 +172,9 @@ class _ManagerState extends State with PreferencesMixin { Widget _buildVmList() { List _widgetList = []; - final Color buttonColor = Theme.of(context).brightness == Brightness.dark ? Colors.white70 : Theme.of(context).colorScheme.primary; + final Color buttonColor = Theme.of(context).brightness == Brightness.dark + ? Colors.white70 + : Theme.of(context).colorScheme.primary; _widgetList.add( Row( mainAxisAlignment: MainAxisAlignment.center, @@ -181,7 +186,8 @@ class _ManagerState extends State with PreferencesMixin { width: 8, ), ElevatedButton( - style: ElevatedButton.styleFrom(primary: Theme.of(context).canvasColor, onPrimary: buttonColor), + style: ElevatedButton.styleFrom( + primary: Theme.of(context).canvasColor, onPrimary: buttonColor), onPressed: () async { String? result = await FilePicker.platform.getDirectoryPath(); if (result != null) { @@ -276,7 +282,9 @@ class _ManagerState extends State with PreferencesMixin { context: context, builder: (BuildContext context) => AlertDialog( title: Text(context.t('Stop The Virtual Machine?')), - content: Text(context.t('You are about to terminate the virtual machine', args: [currentVm])), + content: Text(context.t( + 'You are about to terminate the virtual machine', + args: [currentVm])), actions: [ TextButton( onPressed: () => Navigator.pop(context, false), @@ -300,44 +308,49 @@ class _ManagerState extends State with PreferencesMixin { }, ), IconButton( - icon: Icon( - Icons.delete, - color: active ? null : buttonColor, - semanticLabel: 'Delete' - ), - onPressed: active ? null : () { - showDialog( - context: context, - builder: (BuildContext context) => AlertDialog( - title: Text('Delete ' + currentVm), - content: Text( - 'You are about to delete ' + currentVm + '. This cannot be undone. ' + - 'Would you like to delete the disk image but keep the ' + - 'configuration, or delete the whole VM?' - ), - actions: [ - TextButton( - child: Text('Cancel'), - onPressed: () => Navigator.pop(context, 'cancel'), - ), - TextButton( - child: Text('Delete disk image'), - onPressed: () => Navigator.pop(context, 'disk'), - ), - TextButton( - child: Text('Delete whole VM'), - onPressed: () => Navigator.pop(context, 'vm'), - ) // set up the AlertDialog - ], - ), - ).then((result) async { - result = result ?? 'cancel'; - if (result != 'cancel') { - List args = ['--vm', currentVm + '.conf', '--delete-' + result]; - await Process.start('quickemu', args); - } - }); - }, + icon: Icon(Icons.delete, + color: active ? null : buttonColor, + semanticLabel: 'Delete'), + onPressed: active + ? null + : () { + showDialog( + context: context, + builder: (BuildContext context) => AlertDialog( + title: Text('Delete ' + currentVm), + content: Text('You are about to delete ' + + currentVm + + '. This cannot be undone. ' + + 'Would you like to delete the disk image but keep the ' + + 'configuration, or delete the whole VM?'), + actions: [ + TextButton( + child: Text('Cancel'), + onPressed: () => + Navigator.pop(context, 'cancel'), + ), + TextButton( + child: Text('Delete disk image'), + onPressed: () => Navigator.pop(context, 'disk'), + ), + TextButton( + child: Text('Delete whole VM'), + onPressed: () => Navigator.pop(context, 'vm'), + ) // set up the AlertDialog + ], + ), + ).then((result) async { + result = result ?? 'cancel'; + if (result != 'cancel') { + List args = [ + '--vm', + currentVm + '.conf', + '--delete-' + result + ]; + await Process.start('quickemu', args); + } + }); + }, ), ], )), @@ -351,7 +364,9 @@ class _ManagerState extends State with PreferencesMixin { color: _spicy ? buttonColor : null, semanticLabel: 'Connect display with SPICE', ), - tooltip: _spicy ? 'Connect display with SPICE' : 'SPICE client not found', + tooltip: _spicy + ? 'Connect display with SPICE' + : 'SPICE client not found', onPressed: !_spicy ? null : () { @@ -359,19 +374,25 @@ class _ManagerState extends State with PreferencesMixin { }, ), IconButton( - icon: SvgPicture.asset('assets/images/console.svg', semanticsLabel: 'Connect with SSH', color: sshy ? buttonColor : Colors.grey), - tooltip: sshy ? 'Connect with SSH' : 'SSH server not detected on guest', + icon: SvgPicture.asset('assets/images/console.svg', + semanticsLabel: 'Connect with SSH', + color: sshy ? buttonColor : Colors.grey), + tooltip: sshy + ? 'Connect with SSH' + : 'SSH server not detected on guest', onPressed: !sshy ? null : () { - TextEditingController _usernameController = TextEditingController(); + TextEditingController _usernameController = + TextEditingController(); showDialog( context: context, builder: (BuildContext context) => AlertDialog( title: Text('Launch SSH connection to $currentVm'), content: TextField( controller: _usernameController, - decoration: const InputDecoration(hintText: "SSH username"), + decoration: const InputDecoration( + hintText: "SSH username"), ), actions: [ TextButton( @@ -387,10 +408,16 @@ class _ManagerState extends State with PreferencesMixin { ).then((result) { result = result ?? false; if (result) { - List sshArgs = ['ssh', '-p', vmInfo.sshPort!, _usernameController.text + '@localhost']; + List sshArgs = [ + 'ssh', + '-p', + vmInfo.sshPort!, + _usernameController.text + '@localhost' + ]; // Set the arguments to execute the ssh command in the default terminal. // Strip the extension as x-terminal-emulator may point to a .wrapper - switch (path.basenameWithoutExtension(_terminalEmulator!)) { + switch (path + .basenameWithoutExtension(_terminalEmulator!)) { case 'gnome-terminal': case 'mate-terminal': sshArgs.insert(0, '--'); diff --git a/lib/src/pages/operating_system_selection.dart b/lib/src/pages/operating_system_selection.dart index 4506604..d395ce9 100644 --- a/lib/src/pages/operating_system_selection.dart +++ b/lib/src/pages/operating_system_selection.dart @@ -10,7 +10,8 @@ class OperatingSystemSelection extends StatefulWidget { const OperatingSystemSelection({Key? key}) : super(key: key); @override - State createState() => _OperatingSystemSelectionState(); + State createState() => + _OperatingSystemSelectionState(); } class _OperatingSystemSelectionState extends State { @@ -25,7 +26,9 @@ class _OperatingSystemSelectionState extends State { @override Widget build(BuildContext context) { - var list = gOperatingSystems.where((os) => os.name.toLowerCase().contains(term.toLowerCase())).toList(); + var list = gOperatingSystems + .where((os) => os.name.toLowerCase().contains(term.toLowerCase())) + .toList(); return Scaffold( appBar: AppBar( title: Text(context.t('Select operating system')), @@ -47,7 +50,8 @@ class _OperatingSystemSelectionState extends State { Expanded( child: TextField( focusNode: focusNode, - decoration: InputDecoration.collapsed(hintText: context.t('Search operating system')), + decoration: InputDecoration.collapsed( + hintText: context.t('Search operating system')), onChanged: (value) { setState(() { term = value; diff --git a/lib/src/pages/option_selection.dart b/lib/src/pages/option_selection.dart index 6431650..67128d2 100644 --- a/lib/src/pages/option_selection.dart +++ b/lib/src/pages/option_selection.dart @@ -24,7 +24,9 @@ class _OptionSelectionState extends State { @override Widget build(BuildContext context) { - var list = widget.version.options.where((e) => e.option.toLowerCase().contains(term.toLowerCase())).toList(); + var list = widget.version.options + .where((e) => e.option.toLowerCase().contains(term.toLowerCase())) + .toList(); return Scaffold( appBar: AppBar( @@ -49,7 +51,8 @@ class _OptionSelectionState extends State { Expanded( child: TextField( focusNode: focusNode, - decoration: InputDecoration.collapsed(hintText: context.t('Search option')), + decoration: InputDecoration.collapsed( + hintText: context.t('Search option')), onChanged: (value) { setState(() { term = value; diff --git a/lib/src/pages/version_selection.dart b/lib/src/pages/version_selection.dart index 51aa03d..cba1b8b 100644 --- a/lib/src/pages/version_selection.dart +++ b/lib/src/pages/version_selection.dart @@ -8,7 +8,8 @@ import '../model/version.dart'; import 'option_selection.dart'; class VersionSelection extends StatefulWidget { - const VersionSelection({Key? key, required this.operatingSystem}) : super(key: key); + const VersionSelection({Key? key, required this.operatingSystem}) + : super(key: key); final OperatingSystem operatingSystem; @@ -21,7 +22,8 @@ class _VersionSelectionState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text(context.t('Select version for {0}', args: [widget.operatingSystem.name])), + title: Text(context + .t('Select version for {0}', args: [widget.operatingSystem.name])), ), body: SingleChildScrollView( child: Column( @@ -36,17 +38,23 @@ class _VersionSelectionState extends State { child: ListTile( title: Text(item.version), onTap: () { - if (widget.operatingSystem.versions[index].options.length > 1) { + if (widget + .operatingSystem.versions[index].options.length > + 1) { Navigator.of(context) - .push