From 10f15889cc6353259bade834a5f561923179fddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Wed, 8 Sep 2021 15:15:29 +0200 Subject: [PATCH] Improved design of Global Settings Transitional form: the functionality is the same, changes are mostly visual, with only a minor addition of Version no, release info link and version link. fixes QubesOS/qubes-issues#6858 --- debian/install | 2 + qubesmanager/global_settings.css | 26 + qubesmanager/global_settings.py | 44 +- rpm_spec/qmgr.spec.in | 1 + setup.py | 2 +- ui/globalsettingsdlg.ui | 1353 ++++++++++++++++++++---------- 6 files changed, 988 insertions(+), 440 deletions(-) create mode 100644 qubesmanager/global_settings.css diff --git a/debian/install b/debian/install index 1ebd7bbb..688a3343 100644 --- a/debian/install +++ b/debian/install @@ -40,6 +40,8 @@ /usr/lib/*/dist-packages/qubesmanager/resources_rc.py +/usr/lib/*/dist-packages/qubesmanager/global_settings.css + /usr/lib/*/dist-packages/qubesmanager/ui_backupdlg.py /usr/lib/*/dist-packages/qubesmanager/ui_bootfromdevice.py /usr/lib/*/dist-packages/qubesmanager/ui_globalsettingsdlg.py diff --git a/qubesmanager/global_settings.css b/qubesmanager/global_settings.css new file mode 100644 index 00000000..13d579bd --- /dev/null +++ b/qubesmanager/global_settings.css @@ -0,0 +1,26 @@ + +QPushButton { + padding: 10px; + margin-left: 30px; +} + +QComboBox { + padding-left: 10px; + padding-right: 10px; +} + +QLabel#label_release { + padding-left: 20px; + padding-top: 0px; + margin-top: 0px; + margin-bottom: 0px; +} + +QLabel#logo_label { + margin-left: 30px; +} + +QCheckBox::indicator { + width: 25px; + height: 25px; +} diff --git a/qubesmanager/global_settings.py b/qubesmanager/global_settings.py index 13922197..f08536d6 100644 --- a/qubesmanager/global_settings.py +++ b/qubesmanager/global_settings.py @@ -22,10 +22,13 @@ import os import subprocess +import pkg_resources from PyQt5 import QtWidgets, QtCore, QtGui # pylint: disable=import-error from qubesadmin.utils import parse_size from qubesadmin import exc +from qubesmanager.releasenotes import ReleaseNotesDialog +from qubesmanager.informationnotes import InformationNotesDialog from . import ui_globalsettingsdlg # pylint: disable=no-name-in-module from . import utils @@ -68,7 +71,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings, def __init__(self, app, qubes_app, parent=None): super().__init__(parent) - self.app = app + self.app: QtWidgets.QApplication = app self.qubes_app = qubes_app self.vm = self.qubes_app.domains[self.qubes_app.local_name] @@ -77,6 +80,8 @@ def __init__(self, app, qubes_app, parent=None): self.buttonBox.accepted.connect(self.save_and_apply) self.buttonBox.rejected.connect(self.reject) + self.__init_ux() + self.__init_system_defaults__() self.__init_kernel_defaults__() self.__init_mem_defaults__() @@ -89,6 +94,39 @@ def setup_application(self): self.app.setApplicationName(self.tr("Qubes Global Settings")) self.app.setWindowIcon(QtGui.QIcon.fromTheme("qubes-manager")) + def __init_ux(self): + icon = QtGui.QIcon.fromTheme('qubes-manager') + pixmap = icon.pixmap(QtCore.QSize(128, 128)) + self.logo_label.setPixmap(pixmap) + self.logo_label.setAttribute( + QtCore.Qt.WidgetAttribute.WA_TranslucentBackground) + + self.setStyleSheet(pkg_resources.resource_string( + __name__, 'global_settings.css').decode()) + + self.label_release.linkActivated.connect(self._link_activated) + + for button in self.buttonBox.buttons(): + button.setMinimumWidth(250) + + req_width = self.scrollAreaWidgetContents_2.sizeHint().width() + 20 + avail_width = self.app.desktop().availableGeometry().width() * 0.9 + + req_height = self.scrollAreaWidgetContents_2.sizeHint().height() + 100 + avail_height = self.app.desktop().availableGeometry().height() * 0.9 + + self.resize(min(req_width, avail_width), min(req_height, avail_height)) + + def _link_activated(self, link): + if link == "version": + dialog = InformationNotesDialog(self) + elif link == "release": + dialog = ReleaseNotesDialog(self) + else: + return + + dialog.exec_() + def setup_widget_with_vms(self, widget, filter_function, allow_none, holder, property_name): try: @@ -472,7 +510,7 @@ def __enable_updates_all(self): reply = QtWidgets.QMessageBox.question( self, self.tr("Change state of all qubes"), self.tr("Are you sure you want to set all qubes to check " - "for updates?"), + "for updates? This will override current qube settings."), QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel) if reply == QtWidgets.QMessageBox.Cancel: return @@ -483,7 +521,7 @@ def __disable_updates_all(self): reply = QtWidgets.QMessageBox.question( self, self.tr("Change state of all qubes"), self.tr("Are you sure you want to set all qubes to not check " - "for updates?"), + "for updates? This will override current qube settings."), QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel) if reply == QtWidgets.QMessageBox.Cancel: return diff --git a/rpm_spec/qmgr.spec.in b/rpm_spec/qmgr.spec.in index f11112f0..ddc4e8e6 100644 --- a/rpm_spec/qmgr.spec.in +++ b/rpm_spec/qmgr.spec.in @@ -97,6 +97,7 @@ rm -rf $RPM_BUILD_ROOT %{python3_sitelib}/qubesmanager/resources_rc.py +%{python3_sitelib}/qubesmanager/global_settings.css %{python3_sitelib}/qubesmanager/ui_backupdlg.py %{python3_sitelib}/qubesmanager/ui_bootfromdevice.py %{python3_sitelib}/qubesmanager/ui_globalsettingsdlg.py diff --git a/setup.py b/setup.py index 561623b1..04470b96 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ url='https://www.qubes-os.org/', packages=setuptools.find_packages(), package_data={ - 'qubesmanager': ['i18n/*'] + 'qubesmanager': ['i18n/*', '*.css'] }, entry_points={ 'console_scripts': [ diff --git a/ui/globalsettingsdlg.ui b/ui/globalsettingsdlg.ui index 946f6dcc..06e224eb 100644 --- a/ui/globalsettingsdlg.ui +++ b/ui/globalsettingsdlg.ui @@ -6,467 +6,948 @@ 0 0 - 842 - 660 + 1032 + 647 + + + 0 + 0 + + + + + 1024 + 600 + + Qubes Global Settings - - - - true + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + - - - 0 - 140 - + + Qt::Horizontal - - Memory Balancer Settings + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - true - - - Minimal qube memory: - - - - - - - true - - - MiB - - - 999999999 - - - 50 - - - - - - - true - - - Additional memory allocated to dom0 by Qubes Memory Balancer. - - - MiB - - - 999999999 - - - 50 - - - - - - - true - - - Additional memory allocated to dom0 by Qubes Memory Balancer. - - - Additional dom0 memory: - - - - - - - Memory balancing is used for dom0 and all qubes that have memory balancing enabled (by default all qubes, except for those with PCI devices connected, such as sys-net and sys-usb). - - - true - - - - - - - - - - Updates + + false - - - - - Default value for new qubes; to change it for existing qubes, use buttons below. - - - Check for qube updates by default - - - - - - - - ITL template updates - - - - - ITL template updates (testing) - - - - - - - - - Stable updates - - - - - Testing updates (security only) - - - - - Testing updates - - - - - Unstable updates - - - - - - - - Disable checking for updates for all qubes - - - - - - - - (Community templates disabled) - - - - - Community template updates - - - - - Community template updates (testing) - - - - - - - - Enable checking for updates for all qubes - - - - - - - - 0 - 0 - - - - dom0 updates: - - - - - - - - 0 - 0 - - - - Templates: - - - - - - - - 0 - 0 - - - - Additional templates: - - - - - - - - 1 - 0 - - - - Check for dom0 updates - - - false - - - - - - - - Window defaults + + + + QFrame::Box - - - - - Allow UTF-8 window titles: - - - - - - - Allow fullscreen: - - - - - - - - - - - - - Tray icon mode: - - - - - - - - - - - - - true + + QFrame::Plain - - - 0 - 140 - + + 1 - - System defaults + + 0 - - - - - - 0 - 0 - - - - Dom0 UpdateVM: - - - - - - - This is updateVM ONLY for dom0; if you want to change updateVMs for other VMs, use /etc/qubes-rpc/policy/qubes.UpdatesProxy - - - - - - - ClockVM: - - - - - - - - - - Default netVM: - - - - - - - - - - - 0 - 0 - - - - Default template: - - - - - - - - - - Default DisposableVM Template: - - - - - - - - - - - - - Clipboard defaults + + Qt::ScrollBarAsNeeded - - - - - Keyboard shortcuts: - - - - - - - Secure copy: - - - - - - - - - - Secure paste: - - - - - - - - - - - - - true + + QAbstractScrollArea::AdjustToContents - - Kernel + + true - - - QFormLayout::AllNonFixedFieldsGrow + + + + 0 + 0 + 1030 + 613 + - - - - Default kernel: - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - + + + 10 + + + 10 + + + 10 + + + 10 + + + 0 + + + + + 10 + + + 10 + + + 10 + + + 10 + + + 5 + + + + + + 0 + 0 + + + + + + + + + + + + 0 + 0 + + + + <html><head/><body><p><span style=" font-family:'Montserrat'; font-size:24pt; font-weight:200;">Qubes OS 4.1</span></p><p><span style=" font-weight:600;"/><a href="release"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">Release Notes</span></a><span style=" font-weight:600;"> ยท </span><a href="version"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">Version Information</span></a></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 5 + 5 + + + + + + + + + + QFrame::Raised + + + 1 + + + Qt::Horizontal + + + + + + + QFrame::Plain + + + 2 + + + Qt::Horizontal + + + + + + + QFrame::Plain + + + 2 + + + Qt::Horizontal + + + + + + + 5 + + + 10 + + + 10 + + + 10 + + + 10 + + + + + + 20 + 37 + false + + + + font-weight: 300 + + + Updater checks + + + + + + + + 10 + + + + Select which updates the Qubes Updater automatically checks for. + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + check for dom0 updates + + + + + + + check for qubes updates (as default for new qubes) + + + + + + + Disable or enable updater checks for individual qubes on this machine: + + + true + + + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Enable All + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Disable All + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 5 + + + + + + + + + + 10 + + + 10 + + + 10 + + + 10 + + + 5 + + + + + + 10 + + + + Set your system's default qubes. + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + + + + + + + + + DisposableVM Template + + + + + + + NetVM + + + + + + + + 20 + 37 + false + + + + font-weight: 300 + + + qube defaults + + + + + + + Template + + + + + + + ClockVM + + + + + + + dom0 Updates Proxy + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 5 + + + + + + + + + + 10 + + + 10 + + + 10 + + + 10 + + + 5 + + + + + UTF-8 window titles: + + + + + + + + 20 + 37 + false + + + + font-weight: 300 + + + Desktop defaults + + + + + + + Show full-screen: + + + + + + + + + + + + + Tray icon style: + + + + + + + + + + Qt::Vertical + + + + 20 + 5 + + + + + + + + + + 10 + + + 10 + + + 10 + + + 10 + + + 5 + + + + + Copy (inter-qube): + + + + + + + + + + + 10 + 75 + true + + + + Global Clipboard + + + + + + + + + + + 20 + 37 + false + + + + font-weight: 300 + + + Keyboard shortcuts + + + + + + + Paste (inter-qube): + + + + + + + Qt::Vertical + + + + 20 + 5 + + + + + + + + + + 10 + + + 10 + + + 10 + + + 10 + + + 5 + + + + + + (Community templates disabled) + + + + + Community template updates + + + + + Community template updates (testing) + + + + + + + + + 20 + 37 + false + + + + font-weight: 300 + + + Source repositories + + + + + + + + Stable updates + + + + + Testing updates (security only) + + + + + Testing updates + + + + + Unstable updates + + + + + + + + + ITL template updates + + + + + ITL template updates (testing) + + + + + + + + Qubes OS official templates: + + + + + + + dom0 updates: + + + + + + + Community templates: + + + + + + + Qt::Vertical + + + + 20 + 5 + + + + + + + + + + 10 + + + 10 + + + 10 + + + 10 + + + 5 + + + + + + 20 + 37 + false + + + + font-weight: 300 + + + Memory balancing + + + + + + + Minimal qube memory: + + + + + + + + 9 + + + + Enabled as default for all qubes, except for those with connected PCI devices + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + Additional dom0 memory: + + + + + + + true + + + Additional memory allocated to dom0 by Qubes Memory Balancer. + + + MiB + + + 999999999 + + + 50 + + + + + + + true + + + MiB + + + 999999999 + + + 50 + + + + + + + Qt::Vertical + + + + 20 + 5 + + + + + + + + + + 10 + + + 10 + + + 10 + + + 10 + + + 5 + + + + + + 20 + 37 + false + + + + font-weight: 300 + + + Linux kernel + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 10 + + + + Default kernel used by qubes: + + + + + + + Qt::Vertical + + + + 5 + 5 + + + + + + + + - - - - Qt::Vertical - - - - 20 - 40 - - - - - update_vm_combo - clock_vm_combo - default_netvm_combo - default_template_combo - default_dispvm_combo - min_vm_mem - dom0_mem_boost - default_kernel_combo - updates_dom0 - updates_vm - disable_updates_all - enable_updates_all buttonBox