Make the server button and URL display much nicer, and replace string "URL" with "address" for usability

This commit is contained in:
Micah Lee 2018-02-06 16:01:59 -08:00
parent f23e2a8a90
commit 24a672dac9
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
3 changed files with 53 additions and 21 deletions

View File

@ -128,7 +128,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
# Primary action layout
primary_action_layout = QtWidgets.QVBoxLayout()
primary_action_layout.addLayout(self.server_status)
primary_action_layout.addWidget(self.server_status)
primary_action_layout.addWidget(self.filesize_warning)
primary_action_layout.addWidget(self.persistent_url_label)
primary_action_layout.addWidget(self.downloads_container)

View File

@ -23,7 +23,7 @@ from PyQt5 import QtCore, QtWidgets, QtGui
from onionshare import strings, common, settings
class ServerStatus(QtWidgets.QVBoxLayout):
class ServerStatus(QtWidgets.QWidget):
"""
The server status chunk of the GUI.
"""
@ -91,23 +91,41 @@ class ServerStatus(QtWidgets.QVBoxLayout):
# URL layout
url_font = QtGui.QFont()
self.url_description = QtWidgets.QLabel(strings._('gui_url_description', True))
self.url_description.setWordWrap(True)
self.url_label = QtWidgets.QLabel()
self.url_label.setFont(url_font)
self.url_label.setWordWrap(False)
self.url_label.setAlignment(QtCore.Qt.AlignCenter)
self.url_label.setStyleSheet('QLabel { color: #666666; font-size: 12px; }')
self.url = QtWidgets.QLabel()
self.url.setFont(url_font)
self.url.setWordWrap(True)
self.url.setStyleSheet('QLabel { background-color: #ffffff; color: #000000; padding: 10px; border: 1px solid #666666; }')
url_buttons_style = 'QPushButton { color: #3f7fcf; }'
self.copy_url_button = QtWidgets.QPushButton(strings._('gui_copy_url', True))
self.copy_url_button.setFlat(True)
self.copy_url_button.setStyleSheet(url_buttons_style)
self.copy_url_button.clicked.connect(self.copy_url)
self.copy_hidservauth_button = QtWidgets.QPushButton(strings._('gui_copy_hidservauth', True))
self.copy_hidservauth_button.setFlat(True)
self.copy_hidservauth_button.setStyleSheet(url_buttons_style)
self.copy_hidservauth_button.clicked.connect(self.copy_hidservauth)
url_layout = QtWidgets.QHBoxLayout()
url_buttons_layout = QtWidgets.QHBoxLayout()
url_buttons_layout.addWidget(self.copy_url_button)
url_buttons_layout.addWidget(self.copy_hidservauth_button)
url_buttons_layout.addStretch()
url_layout = QtWidgets.QVBoxLayout()
url_layout.addWidget(self.url_description)
url_layout.addWidget(self.url_label)
url_layout.addWidget(self.copy_url_button)
url_layout.addWidget(self.copy_hidservauth_button)
url_layout.addWidget(self.url)
url_layout.addLayout(url_buttons_layout)
# Add the widgets
self.addLayout(server_layout)
self.addLayout(url_layout)
self.addWidget(self.server_shutdown_timeout_container)
layout = QtWidgets.QVBoxLayout()
layout.addLayout(server_layout)
layout.addLayout(url_layout)
layout.addWidget(self.server_shutdown_timeout_container)
self.setLayout(layout)
self.update()
@ -149,8 +167,17 @@ class ServerStatus(QtWidgets.QVBoxLayout):
# Set the URL fields
if self.status == self.STATUS_STARTED:
self.url_label.setText('http://{0:s}/{1:s}'.format(self.app.onion_host, self.web.slug))
self.url_description.show()
if self.settings.get('close_after_first_download'):
self.url_label.setText(strings._('gui_url_label_one_time', True))
else:
self.url_label.setText(strings._('gui_url_label', True))
self.url_label.show()
self.url.setText('http://{0:s}/{1:s}'.format(self.app.onion_host, self.web.slug))
self.url.show()
self.copy_url_button.show()
if self.settings.get('save_private_key'):
@ -167,7 +194,9 @@ class ServerStatus(QtWidgets.QVBoxLayout):
p = self.parentWidget()
p.resize(p.sizeHint())
else:
self.url_description.hide()
self.url_label.hide()
self.url.hide()
self.copy_url_button.hide()
self.copy_hidservauth_button.hide()

View File

@ -5,14 +5,14 @@
"wait_for_hs_trying": "Trying...",
"wait_for_hs_nope": "Not ready yet.",
"wait_for_hs_yup": "Ready!",
"give_this_url": "Give this URL to the person you're sending the file to:",
"give_this_url_stealth": "Give this URL and HidServAuth line to the person you're sending the file to:",
"give_this_url": "Give this address to the person you're sending the file to:",
"give_this_url_stealth": "Give this address and HidServAuth line to the person you're sending the file to:",
"ctrlc_to_stop": "Press Ctrl-C to stop server",
"not_a_file": "{0:s} is not a valid file.",
"not_a_readable_file": "{0:s} is not a readable file.",
"no_available_port": "Could not start the Onion service as there was no available port.",
"download_page_loaded": "Download page loaded",
"other_page_loaded": "URL loaded",
"other_page_loaded": "Address loaded",
"close_on_timeout": "Closing automatically because timeout was reached",
"closing_automatically": "Closing automatically because download finished",
"timeout_download_still_running": "Waiting for download to complete before auto-stopping",
@ -40,11 +40,11 @@
"gui_choose_items": "Choose",
"gui_start_server": "Start Sharing",
"gui_stop_server": "Stop Sharing",
"gui_copy_url": "Copy URL",
"gui_copy_url": "Copy Address",
"gui_copy_hidservauth": "Copy HidServAuth",
"gui_downloads": "Downloads:",
"gui_canceled": "Canceled",
"gui_copied_url": "Copied URL to clipboard",
"gui_copied_url": "Copied address to clipboard",
"gui_copied_hidservauth": "Copied HidServAuth line to clipboard",
"gui_starting_server1": "Starting Tor onion service...",
"gui_starting_server2": "Crunching files...",
@ -56,10 +56,10 @@
"gui_download_progress_starting": "{0:s}, %p% (Computing ETA)",
"gui_download_progress_eta": "{0:s}, ETA: {1:s}, %p%",
"version_string": "Onionshare {0:s} | https://onionshare.org/",
"gui_quit_warning": "Are you sure you want to quit?\nThe URL you are sharing won't exist anymore.",
"gui_quit_warning": "Are you sure you want to quit?\nThe address you are sharing won't exist anymore.",
"gui_quit_warning_quit": "Quit",
"gui_quit_warning_dont_quit": "Don't Quit",
"error_rate_limit": "An attacker might be trying to guess your URL. To prevent this, OnionShare has automatically stopped the server. To share the files you must start it again and share the new URL.",
"error_rate_limit": "An attacker might be trying to guess your address. To prevent this, OnionShare has automatically stopped the server. To share the files you must start it again and share the new address.",
"zip_progress_bar_format": "Crunching files: %p%",
"error_stealth_not_supported": "To create stealth onion services, you need at least Tor 0.2.9.1-alpha (or Tor Browser 6.5) and at least python3-stem 1.5.0.",
"error_ephemeral_not_supported": "OnionShare requires at least at least Tor 0.2.7.1 and at least python3-stem 1.4.0.",
@ -131,6 +131,9 @@
"gui_server_started_after_timeout": "The server started after your chosen auto-timeout.\nPlease start a new share.",
"gui_server_timeout_expired": "The chosen timeout has already expired.\nPlease update the timeout and then you may start sharing.",
"share_via_onionshare": "Share via OnionShare",
"gui_save_private_key_checkbox": "Use a persistent URL\n(unchecking will delete any saved URL)",
"persistent_url_in_use": "This share is using a persistent URL"
"gui_save_private_key_checkbox": "Use a persistent address\n(unchecking will delete any saved address)",
"persistent_url_in_use": "This share is using a persistent address",
"gui_url_description": "<b>Anyone</b> with this link can <b>download</b> your files using <b>Tor Browser</b>:",
"gui_url_label": "Your Download Address",
"gui_url_label_one_time": "Your One-Time Download Address"
}