Reintroduce the titles in the QR codes to help differentiate them

This commit is contained in:
Miguel Jacq 2021-08-31 14:23:33 +10:00
parent cb144e218a
commit 30b12cac55
No known key found for this signature in database
GPG Key ID: EEA4341C6D97A0B6
2 changed files with 16 additions and 3 deletions

View File

@ -485,13 +485,21 @@ class ServerStatus(QtWidgets.QWidget):
"""
Show a QR code of the onion URL.
"""
self.qr_code_dialog = QRCodeDialog(self.common, self.get_url())
self.qr_code_dialog = QRCodeDialog(
self.common,
strings._("gui_qr_label_url_title"),
self.get_url()
)
def show_client_auth_qr_code_button_clicked(self):
"""
Show a QR code of the private key
"""
self.qr_code_dialog = QRCodeDialog(self.common, self.app.auth_string)
self.qr_code_dialog = QRCodeDialog(
self.common,
strings._("gui_qr_label_auth_string_title"),
self.app.auth_string
)
def start_server(self):
"""

View File

@ -130,13 +130,17 @@ class QRCodeDialog(QtWidgets.QDialog):
A dialog showing a QR code.
"""
def __init__(self, common, text):
def __init__(self, common, title, text):
super(QRCodeDialog, self).__init__()
self.common = common
self.common.log("QrCode", "__init__")
self.qr_label_title = QtWidgets.QLabel(self)
self.qr_label_title.setText(title)
self.qr_label_title.setAlignment(QtCore.Qt.AlignCenter)
self.qr_label = QtWidgets.QLabel(self)
self.qr_label.setPixmap(qrcode.make(text, image_factory=Image).pixmap())
self.qr_label.setScaledContents(True)
@ -145,6 +149,7 @@ class QRCodeDialog(QtWidgets.QDialog):
self.setWindowTitle(strings._("gui_qr_code_dialog_title"))
self.setWindowIcon(QtGui.QIcon(GuiCommon.get_resource_path("images/logo.png")))
layout = QtWidgets.QVBoxLayout(self)
layout.addWidget(self.qr_label_title)
layout.addWidget(self.qr_label)
self.exec_()