From 30b12cac5582f2468b11178e80ae27ae39f018db Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Tue, 31 Aug 2021 14:23:33 +1000 Subject: [PATCH] Reintroduce the titles in the QR codes to help differentiate them --- desktop/src/onionshare/tab/server_status.py | 12 ++++++++++-- desktop/src/onionshare/widgets.py | 7 ++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/desktop/src/onionshare/tab/server_status.py b/desktop/src/onionshare/tab/server_status.py index 41a0d87a..2fc816a8 100644 --- a/desktop/src/onionshare/tab/server_status.py +++ b/desktop/src/onionshare/tab/server_status.py @@ -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): """ diff --git a/desktop/src/onionshare/widgets.py b/desktop/src/onionshare/widgets.py index 1d256782..b396c43f 100644 --- a/desktop/src/onionshare/widgets.py +++ b/desktop/src/onionshare/widgets.py @@ -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_()