mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-10 19:52:50 -03:00
Re-work the UI widgets to make it smaller on Macbook Pro and other smaller screens
This commit is contained in:
parent
3280e5428b
commit
7e175cb7e3
3 changed files with 31 additions and 23 deletions
|
@ -346,6 +346,9 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||
if self.server_status.file_selection.get_num_files() > 0:
|
||||
self.server_status.server_button.setEnabled(True)
|
||||
self.status_bar.clearMessage()
|
||||
# If we switched off the shutdown timeout setting, ensure the widget is hidden.
|
||||
if not self.settings.get('shutdown_timeout'):
|
||||
self.server_status.shutdown_timeout_container.hide()
|
||||
|
||||
d = SettingsDialog(self.onion, self.qtapp, self.config)
|
||||
d.settings_saved.connect(reload_settings)
|
||||
|
@ -629,6 +632,9 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||
if self.server_status.status == self.server_status.STATUS_STARTED:
|
||||
if self.app.shutdown_timer and self.settings.get('shutdown_timeout'):
|
||||
if self.timeout > 0:
|
||||
now = QtCore.QDateTime.currentDateTime()
|
||||
seconds_remaining = now.secsTo(self.server_status.timeout)
|
||||
self.server_status.server_button.setText(strings._('gui_stop_server_shutdown_timeout', True).format(seconds_remaining))
|
||||
if not self.app.shutdown_timer.is_alive():
|
||||
# If there were no attempts to download the share, or all downloads are done, we can stop
|
||||
if web.download_count == 0 or web.done:
|
||||
|
|
|
@ -67,6 +67,8 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
shutdown_timeout_container_layout.addLayout(shutdown_timeout_layout)
|
||||
self.shutdown_timeout_container = QtWidgets.QWidget()
|
||||
self.shutdown_timeout_container.setLayout(shutdown_timeout_container_layout)
|
||||
self.shutdown_timeout_container.hide()
|
||||
|
||||
|
||||
# Server layout
|
||||
self.server_button = QtWidgets.QPushButton()
|
||||
|
@ -77,8 +79,6 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
self.url_description = QtWidgets.QLabel(strings._('gui_url_description', True))
|
||||
self.url_description.setWordWrap(True)
|
||||
self.url_description.setMinimumHeight(50)
|
||||
self.url_label = QtWidgets.QLabel()
|
||||
self.url_label.setStyleSheet('QLabel { color: #666666; font-size: 12px; }')
|
||||
self.url = QtWidgets.QLabel()
|
||||
self.url.setFont(url_font)
|
||||
self.url.setWordWrap(True)
|
||||
|
@ -102,7 +102,6 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
|
||||
url_layout = QtWidgets.QVBoxLayout()
|
||||
url_layout.addWidget(self.url_description)
|
||||
url_layout.addWidget(self.url_label)
|
||||
url_layout.addWidget(self.url)
|
||||
url_layout.addLayout(url_buttons_layout)
|
||||
|
||||
|
@ -131,19 +130,18 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
self.url_description.show()
|
||||
|
||||
info_image = common.get_resource_path('images/info.png')
|
||||
self.url_label.setText(strings._('gui_url_label', True).format(info_image))
|
||||
self.url_description.setText(strings._('gui_url_description', True).format(info_image))
|
||||
# Show a Tool Tip explaining the lifecycle of this URL
|
||||
if self.settings.get('save_private_key'):
|
||||
if self.settings.get('close_after_first_download'):
|
||||
self.url_label.setToolTip(strings._('gui_url_label_onetime_and_persistent', True))
|
||||
self.url_description.setToolTip(strings._('gui_url_label_onetime_and_persistent', True))
|
||||
else:
|
||||
self.url_label.setToolTip(strings._('gui_url_label_persistent', True))
|
||||
self.url_description.setToolTip(strings._('gui_url_label_persistent', True))
|
||||
else:
|
||||
if self.settings.get('close_after_first_download'):
|
||||
self.url_label.setToolTip(strings._('gui_url_label_onetime', True))
|
||||
self.url_description.setToolTip(strings._('gui_url_label_onetime', True))
|
||||
else:
|
||||
self.url_label.setToolTip(strings._('gui_url_label_stay_open', True))
|
||||
self.url_label.show()
|
||||
self.url_description.setToolTip(strings._('gui_url_label_stay_open', True))
|
||||
|
||||
self.url.setText('http://{0:s}/{1:s}'.format(self.app.onion_host, self.web.slug))
|
||||
self.url.show()
|
||||
|
@ -155,13 +153,15 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
self.settings.set('slug', self.web.slug)
|
||||
self.settings.save()
|
||||
|
||||
if self.settings.get('shutdown_timeout'):
|
||||
self.shutdown_timeout_container.hide()
|
||||
|
||||
if self.app.stealth:
|
||||
self.copy_hidservauth_button.show()
|
||||
else:
|
||||
self.copy_hidservauth_button.hide()
|
||||
else:
|
||||
self.url_description.hide()
|
||||
self.url_label.hide()
|
||||
self.url.hide()
|
||||
self.copy_url_button.hide()
|
||||
self.copy_hidservauth_button.hide()
|
||||
|
@ -175,31 +175,32 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
else:
|
||||
self.server_button.show()
|
||||
|
||||
if self.settings.get('shutdown_timeout'):
|
||||
self.shutdown_timeout_container.show()
|
||||
else:
|
||||
self.shutdown_timeout_container.hide()
|
||||
|
||||
if self.status == self.STATUS_STOPPED:
|
||||
self.server_button.setStyleSheet(button_stopped_style)
|
||||
self.server_button.setEnabled(True)
|
||||
self.server_button.setText(strings._('gui_start_server', True))
|
||||
self.shutdown_timeout.setEnabled(True)
|
||||
self.server_button.setToolTip('')
|
||||
if self.settings.get('shutdown_timeout'):
|
||||
self.shutdown_timeout_container.show()
|
||||
elif self.status == self.STATUS_STARTED:
|
||||
self.server_button.setStyleSheet(button_started_style)
|
||||
self.server_button.setEnabled(True)
|
||||
self.server_button.setText(strings._('gui_stop_server', True))
|
||||
self.shutdown_timeout.setEnabled(False)
|
||||
if self.settings.get('shutdown_timeout'):
|
||||
self.shutdown_timeout_container.hide()
|
||||
self.server_button.setToolTip(strings._('gui_stop_server_shutdown_timeout_tooltip', True).format(self.timeout))
|
||||
elif self.status == self.STATUS_WORKING:
|
||||
self.server_button.setStyleSheet(button_working_style)
|
||||
self.server_button.setEnabled(True)
|
||||
self.server_button.setText(strings._('gui_please_wait'))
|
||||
self.shutdown_timeout.setEnabled(False)
|
||||
if self.settings.get('shutdown_timeout'):
|
||||
self.shutdown_timeout_container.hide()
|
||||
else:
|
||||
self.server_button.setStyleSheet(button_working_style)
|
||||
self.server_button.setEnabled(False)
|
||||
self.server_button.setText(strings._('gui_please_wait'))
|
||||
self.shutdown_timeout.setEnabled(False)
|
||||
if self.settings.get('shutdown_timeout'):
|
||||
self.shutdown_timeout_container.hide()
|
||||
|
||||
def server_button_clicked(self):
|
||||
"""
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
"gui_choose_items": "Choose",
|
||||
"gui_start_server": "Start Sharing",
|
||||
"gui_stop_server": "Stop Sharing",
|
||||
"gui_stop_server_shutdown_timeout": "Stop Sharing ({}s remaining)",
|
||||
"gui_stop_server_shutdown_timeout_tooltip": "Share will stop automatically at {}",
|
||||
"gui_copy_url": "Copy Address",
|
||||
"gui_copy_hidservauth": "Copy HidServAuth",
|
||||
"gui_downloads": "Downloads:",
|
||||
|
@ -135,10 +137,9 @@
|
|||
"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 address\n(unchecking will delete any saved 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 <img src={} />",
|
||||
"gui_url_label_persistent": "This share will not stop automatically<br><br>Every share will have the same address (to use one-time addresses, disable persistence in the Settings)",
|
||||
"gui_url_label_stay_open": "This share will not stop automatically",
|
||||
"gui_url_description": "<b>Anyone</b> with this link can <b>download</b> your files using <b>Tor Browser</b>: <img src={} />",
|
||||
"gui_url_label_persistent": "This share will not stop automatically unless a timer is set.<br><br>Every share will have the same address (to use one-time addresses, disable persistence in the Settings)",
|
||||
"gui_url_label_stay_open": "This share will not stop automatically unless a timer is set.",
|
||||
"gui_url_label_onetime": "This share will stop after the first download",
|
||||
"gui_url_label_onetime_and_persistent": "This share will stop after the first download<br><br>Every share will have the same address (to use one-time addresses, disable persistence in the Settings)",
|
||||
"gui_status_indicator_stopped": "Ready to Share",
|
||||
|
|
Loading…
Reference in a new issue