diff --git a/electrum/gui/icons/electrum_darkblue_1.png b/electrum/gui/icons/electrum_darkblue_1.png new file mode 100644 index 000000000..199e5993c Binary files /dev/null and b/electrum/gui/icons/electrum_darkblue_1.png differ diff --git a/electrum/gui/icons/electrum_text.png b/electrum/gui/icons/electrum_text.png new file mode 100644 index 000000000..546381f28 Binary files /dev/null and b/electrum/gui/icons/electrum_text.png differ diff --git a/electrum/gui/qml/components/wizard/WCAutoConnect.qml b/electrum/gui/qml/components/wizard/WCAutoConnect.qml index c6700da83..1736619a7 100644 --- a/electrum/gui/qml/components/wizard/WCAutoConnect.qml +++ b/electrum/gui/qml/components/wizard/WCAutoConnect.qml @@ -6,6 +6,7 @@ import "../controls" WizardComponent { valid: true + title: qsTr('Server') function apply() { wizard_data['autoconnect'] = serverconnectgroup.checkedButton.connecttype === 'auto' diff --git a/electrum/gui/qml/components/wizard/WCProxyAsk.qml b/electrum/gui/qml/components/wizard/WCProxyAsk.qml index 7b49a0e23..660920eee 100644 --- a/electrum/gui/qml/components/wizard/WCProxyAsk.qml +++ b/electrum/gui/qml/components/wizard/WCProxyAsk.qml @@ -7,6 +7,7 @@ import "../controls" WizardComponent { valid: true + title: qsTr('Proxy') function apply() { wizard_data['want_proxy'] = wantproxygroup.checkedButton.wantproxy diff --git a/electrum/gui/qml/components/wizard/WCProxyConfig.qml b/electrum/gui/qml/components/wizard/WCProxyConfig.qml index b58e29f45..ffaef38fd 100644 --- a/electrum/gui/qml/components/wizard/WCProxyConfig.qml +++ b/electrum/gui/qml/components/wizard/WCProxyConfig.qml @@ -6,6 +6,7 @@ import "../controls" WizardComponent { valid: true + title: qsTr('Proxy') function apply() { wizard_data['proxy'] = pc.toProxyDict() diff --git a/electrum/gui/qml/components/wizard/WCServerConfig.qml b/electrum/gui/qml/components/wizard/WCServerConfig.qml index d22638df2..cfff2e936 100644 --- a/electrum/gui/qml/components/wizard/WCServerConfig.qml +++ b/electrum/gui/qml/components/wizard/WCServerConfig.qml @@ -7,6 +7,7 @@ import "../controls" WizardComponent { valid: true last: true + title: qsTr('Server') function apply() { wizard_data['autoconnect'] = sc.address == "" diff --git a/electrum/gui/qml/components/wizard/WCWelcome.qml b/electrum/gui/qml/components/wizard/WCWelcome.qml new file mode 100644 index 000000000..56754b774 --- /dev/null +++ b/electrum/gui/qml/components/wizard/WCWelcome.qml @@ -0,0 +1,48 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls + +// import org.electrum 1.0 + +import "../controls" + +WizardComponent { + valid: true + title: qsTr('Electrum Bitcoin Wallet') + + function apply() { + wizard_data['use_defaults'] = use_defaults.checked + if (use_defaults.checked) { + wizard_data['autoconnect'] = true + wizard_data['want_proxy'] = false + } + } + + ColumnLayout { + width: parent.width + + Image { + Layout.fillWidth: true + fillMode: Image.PreserveAspectFit + source: Qt.resolvedUrl('../../../icons/electrum_presplash.png') + // reduce spacing a bit + Layout.topMargin: -50 + Layout.bottomMargin: -160 + } + + Label { + Layout.alignment: Qt.AlignHCenter + text: qsTr('Welcome') + font.pixelSize: constants.fontSizeXLarge + Layout.bottomMargin: constants.paddingXXLarge + } + + CheckBox { + id: use_defaults + Layout.alignment: Qt.AlignHCenter + text: qsTr('Use default network settings') + checked: true + onCheckedChanged: checkIsLast() + } + } +} diff --git a/electrum/gui/qml/components/wizard/Wizard.qml b/electrum/gui/qml/components/wizard/Wizard.qml index 85c9ed2ef..f2be0a642 100644 --- a/electrum/gui/qml/components/wizard/Wizard.qml +++ b/electrum/gui/qml/components/wizard/Wizard.qml @@ -15,7 +15,8 @@ ElDialog { padding: 0 - title: wizardTitle + (pages.currentItem.title ? ' - ' + pages.currentItem.title : '') + title: (pages.currentItem.wizard_title ? pages.currentItem.wizard_title : wizardTitle) + + (pages.currentItem.title ? ' - ' + pages.currentItem.title : '') iconSource: '../../../icons/electrum.png' // android back button triggers close() on Popups. Disabling close here, diff --git a/electrum/gui/qml/components/wizard/WizardComponent.qml b/electrum/gui/qml/components/wizard/WizardComponent.qml index 4f2eca587..f40709224 100644 --- a/electrum/gui/qml/components/wizard/WizardComponent.qml +++ b/electrum/gui/qml/components/wizard/WizardComponent.qml @@ -10,6 +10,7 @@ Pane { property var wizard_data : ({}) property bool valid property bool last: false + property string wizard_title: '' property string title: '' property bool securePage: false diff --git a/electrum/gui/qml/qewizard.py b/electrum/gui/qml/qewizard.py index ac289fd67..c905f5ae3 100644 --- a/electrum/gui/qml/qewizard.py +++ b/electrum/gui/qml/qewizard.py @@ -147,6 +147,7 @@ class QEServerConnectWizard(ServerConnectWizard, QEAbstractWizard): # attach view names self.navmap_merge({ + 'welcome': {'gui': 'WCWelcome'}, 'autoconnect': {'gui': 'WCAutoConnect'}, 'proxy_ask': {'gui': 'WCProxyAsk'}, 'proxy_config': {'gui': 'WCProxyConfig'}, diff --git a/electrum/gui/qt/wizard/server_connect.py b/electrum/gui/qt/wizard/server_connect.py index 3d2335fd9..4b0d3a739 100644 --- a/electrum/gui/qt/wizard/server_connect.py +++ b/electrum/gui/qt/wizard/server_connect.py @@ -1,9 +1,13 @@ from typing import TYPE_CHECKING +from PyQt5.QtCore import Qt +from PyQt5.QtGui import QPixmap +from PyQt5.QtWidgets import QCheckBox, QLabel, QHBoxLayout + from electrum.i18n import _ from electrum.wizard import ServerConnectWizard from electrum.gui.qt.network_dialog import ProxyWidget, ServerWidget -from electrum.gui.qt.util import ChoiceWidget +from electrum.gui.qt.util import ChoiceWidget, icon_path from .wizard import QEAbstractWizard, WizardComponent if TYPE_CHECKING: @@ -18,18 +22,55 @@ class QEServerConnectWizard(ServerConnectWizard, QEAbstractWizard): def __init__(self, config: 'SimpleConfig', app: 'QElectrumApplication', plugins: 'Plugins', daemon: 'Daemon', parent=None): ServerConnectWizard.__init__(self, daemon) QEAbstractWizard.__init__(self, config, app) - - self.setWindowTitle(_('Network and server configuration')) + self.window_title = _('Network and server configuration') # attach gui classes self.navmap_merge({ - 'autoconnect': { 'gui': WCAutoConnect }, - 'proxy_ask': { 'gui': WCProxyAsk }, - 'proxy_config': { 'gui': WCProxyConfig }, - 'server_config': { 'gui': WCServerConfig }, + 'welcome': {'gui': WCWelcome, 'params': {'icon': ''}}, + 'proxy_ask': {'gui': WCProxyAsk}, + 'autoconnect': {'gui': WCAutoConnect}, + 'proxy_config': {'gui': WCProxyConfig}, + 'server_config': {'gui': WCServerConfig}, }) +class WCWelcome(WizardComponent): + def __init__(self, parent, wizard): + WizardComponent.__init__(self, parent, wizard, title='') + self.wizard_title = _('Electrum Bitcoin Wallet') + self.use_defaults_w = QCheckBox(_('Use default network settings')) + self.use_defaults_w.setChecked(True) + self.use_defaults_w.stateChanged.connect(self.on_updated) + self.img_label = QLabel() + pixmap = QPixmap(icon_path('electrum_darkblue_1.png')) + self.img_label.setPixmap(pixmap) + self.img_label2 = QLabel() + pixmap = QPixmap(icon_path('electrum_text.png')) + self.img_label2.setPixmap(pixmap) + hbox = QHBoxLayout() + hbox.addStretch(1) + hbox.addWidget(self.img_label) + hbox.addWidget(self.img_label2) + hbox.addStretch(1) + self.layout().addLayout(hbox) + self.welcome_label = QLabel('Welcome') + font = self.welcome_label.font() + font.setPointSize(font.pointSize() + 3) + self.welcome_label.setFont(font) + self.layout().addStretch(1) + self.layout().addWidget(self.welcome_label, False, Qt.AlignHCenter) + self.layout().addStretch(1) + self.layout().addWidget(self.use_defaults_w, False, Qt.AlignHCenter) + self.layout().addStretch(1) + self._valid = True + + def apply(self): + self.wizard_data['use_defaults'] = self.use_defaults_w.isChecked() + if self.use_defaults_w.isChecked(): + self.wizard_data['autoconnect'] = True + self.wizard_data['want_proxy'] = False + + class WCAutoConnect(WizardComponent): def __init__(self, parent, wizard): WizardComponent.__init__(self, parent, wizard, title=_("How do you want to connect to a server? ")) diff --git a/electrum/gui/qt/wizard/wallet.py b/electrum/gui/qt/wizard/wallet.py index 29c845845..1d58bb715 100644 --- a/electrum/gui/qt/wizard/wallet.py +++ b/electrum/gui/qt/wizard/wallet.py @@ -55,8 +55,7 @@ class QENewWalletWizard(NewWalletWizard, QEAbstractWizard, MessageBoxMixin): def __init__(self, config: 'SimpleConfig', app: 'QElectrumApplication', plugins: 'Plugins', daemon: Daemon, path, *, start_viewstate=None): NewWalletWizard.__init__(self, daemon, plugins) QEAbstractWizard.__init__(self, config, app, start_viewstate=start_viewstate) - - self.setWindowTitle(_('Create/Restore wallet')) + self.window_title = _('Create/Restore wallet') self._path = path self._password = None diff --git a/electrum/gui/qt/wizard/wizard.py b/electrum/gui/qt/wizard/wizard.py index 559a505ef..3e48212b9 100644 --- a/electrum/gui/qt/wizard/wizard.py +++ b/electrum/gui/qt/wizard/wizard.py @@ -39,6 +39,7 @@ class QEAbstractWizard(QDialog, MessageBoxMixin): self.setMinimumSize(600, 400) self.title = QLabel() + self.window_title = '' self.main_widget = ResizableStackedWidget(self) @@ -125,7 +126,7 @@ class QEAbstractWizard(QDialog, MessageBoxMixin): viewstate = self._current = self.start_viewstate else: viewstate = self.start_wizard() - self.load_next_component(viewstate.view, viewstate.wizard_data) + self.load_next_component(viewstate.view, viewstate.wizard_data, viewstate.params) def load_next_component(self, view, wdata=None, params=None): if wdata is None: @@ -167,6 +168,7 @@ class QEAbstractWizard(QDialog, MessageBoxMixin): def update(self): page = self.main_widget.currentWidget() + self.setWindowTitle(page.wizard_title if page.wizard_title else self.window_title) self.title.setText(f'{page.title}' if page.title else '') self.back_button.setText(_('Back') if self.can_go_back() else _('Cancel')) self.back_button.setEnabled(not page.busy) @@ -178,8 +180,11 @@ class QEAbstractWizard(QDialog, MessageBoxMixin): self.error_msg.setText(str(page.error)) self.error.setVisible(not page.busy and bool(page.error)) icon = page.params.get('icon', icon_path('electrum.png')) - if icon != self.icon_filename: + if icon and icon != self.icon_filename: self.set_icon(icon) + self.logo.setVisible(True) + else: + self.logo.setVisible(False) def on_back_button_clicked(self): if self.can_go_back(): @@ -238,6 +243,7 @@ class WizardComponent(QWidget): self.setLayout(layout if layout else QVBoxLayout(self)) self.wizard_data = {} self.title = title if title is not None else 'No title' + self.wizard_title = None self.busy_msg = '' self.wizard = wizard self._error = '' diff --git a/electrum/wizard.py b/electrum/wizard.py index 5307f2455..c32c9d855 100644 --- a/electrum/wizard.py +++ b/electrum/wizard.py @@ -264,7 +264,9 @@ class NewWalletWizard(AbstractWizard): if initial_data is None: initial_data = {} self.reset() - self._current = WizardViewState('wallet_name', initial_data, {}) + start_view = 'wallet_name' + params = self.navmap[start_view].get('params', {}) + self._current = WizardViewState(start_view, initial_data, params) return self._current def is_single_password(self) -> bool: @@ -652,14 +654,18 @@ class ServerConnectWizard(AbstractWizard): def __init__(self, daemon: 'Daemon'): AbstractWizard.__init__(self) self.navmap = { + 'welcome': { + 'next': 'proxy_ask', + 'last': lambda d: d['use_defaults'] + }, + 'proxy_ask': { + 'next': lambda d: 'proxy_config' if d['want_proxy'] else 'autoconnect' + }, 'autoconnect': { 'next': 'server_config', 'accept': self.do_configure_autoconnect, 'last': lambda d: d['autoconnect'] }, - 'proxy_ask': { - 'next': lambda d: 'proxy_config' if d['want_proxy'] else 'autoconnect' - }, 'proxy_config': { 'next': 'autoconnect', 'accept': self.do_configure_proxy @@ -704,5 +710,7 @@ class ServerConnectWizard(AbstractWizard): if initial_data is None: initial_data = {} self.reset() - self._current = WizardViewState('proxy_ask', initial_data, {}) + start_view = 'welcome' + params = self.navmap[start_view].get('params', {}) + self._current = WizardViewState(start_view, initial_data, params) return self._current