Make different strings for start server button for different modes

This commit is contained in:
Micah Lee 2018-04-25 20:14:27 -07:00
parent 2fc4330ee4
commit 996f1d3a81
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
13 changed files with 45 additions and 32 deletions

View File

@ -39,7 +39,7 @@ class ServerStatus(QtWidgets.QWidget):
STATUS_WORKING = 1
STATUS_STARTED = 2
def __init__(self, common, qtapp, app, web, file_selection=None):
def __init__(self, common, qtapp, app, web, share_mode, file_selection=None):
super(ServerStatus, self).__init__()
self.common = common
@ -51,7 +51,9 @@ class ServerStatus(QtWidgets.QWidget):
self.web = web
# Only used in share mode
self.file_selection = file_selection
self.share_mode = share_mode
if self.share_mode:
self.file_selection = file_selection
# Shutdown timeout layout
self.shutdown_timeout_label = QtWidgets.QLabel(strings._('gui_settings_shutdown_timeout', True))
@ -73,7 +75,6 @@ class ServerStatus(QtWidgets.QWidget):
self.shutdown_timeout_container.setLayout(shutdown_timeout_container_layout)
self.shutdown_timeout_container.hide()
# Server layout
self.server_button = QtWidgets.QPushButton()
self.server_button.clicked.connect(self.server_button_clicked)
@ -175,7 +176,7 @@ class ServerStatus(QtWidgets.QWidget):
button_working_style = 'QPushButton { background-color: #4c8211; color: #ffffff; padding: 10px; border: 0; border-radius: 5px; font-style: italic; }'
button_started_style = 'QPushButton { background-color: #d0011b; color: #ffffff; padding: 10px; border: 0; border-radius: 5px; }'
if self.file_selection and self.file_selection.get_num_files() == 0:
if self.share_mode and self.file_selection.get_num_files() == 0:
self.server_button.hide()
else:
self.server_button.show()
@ -183,17 +184,27 @@ class ServerStatus(QtWidgets.QWidget):
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))
if self.share_mode:
self.server_button.setText(strings._('gui_share_start_server', True))
else:
self.server_button.setText(strings._('gui_receive_start_server', True))
self.server_button.setToolTip('')
if self.common.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))
if self.share_mode:
self.server_button.setText(strings._('gui_share_stop_server', True))
else:
self.server_button.setText(strings._('gui_share_stop_server', True))
if self.common.settings.get('shutdown_timeout'):
self.shutdown_timeout_container.hide()
self.server_button.setToolTip(strings._('gui_stop_server_shutdown_timeout_tooltip', True).format(self.timeout))
if self.share_mode:
self.server_button.setToolTip(strings._('gui_share_stop_server_shutdown_timeout_tooltip', True).format(self.timeout))
else:
self.server_button.setToolTip(strings._('gui_receive_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)

View File

@ -158,7 +158,7 @@ class ShareMode(QtWidgets.QWidget):
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))
self.server_status.server_button.setText(strings._('gui_share_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 self.web.download_count == 0 or self.web.done:

View File

@ -25,8 +25,8 @@
"gui_add": "Přidat",
"gui_delete": "Smazat",
"gui_choose_items": "Vybrat",
"gui_start_server": "Spustit sdílení",
"gui_stop_server": "Zastavit sdílení",
"gui_share_start_server": "Spustit sdílení",
"gui_share_stop_server": "Zastavit sdílení",
"gui_copy_url": "Kopírovat URL",
"gui_copy_hidservauth": "Kopírovat HidServAuth",
"gui_downloads": "Stahování:",

View File

@ -38,8 +38,8 @@
"gui_add": "Tilføj",
"gui_delete": "Slet",
"gui_choose_items": "Vælg",
"gui_start_server": "Start deling",
"gui_stop_server": "Stop deling",
"gui_share_start_server": "Start deling",
"gui_share_stop_server": "Stop deling",
"gui_copy_url": "Kopiér URL",
"gui_copy_hidservauth": "Kopiér HidServAuth",
"gui_downloads": "Downloads:",

View File

@ -25,8 +25,8 @@
"gui_add": "Hinzufügen",
"gui_delete": "Löschen",
"gui_choose_items": "Auswählen",
"gui_start_server": "Server starten",
"gui_stop_server": "Server anhalten",
"gui_share_start_server": "Server starten",
"gui_share_stop_server": "Server anhalten",
"gui_copy_url": "URL kopieren",
"gui_downloads": "Downloads:",
"gui_copied_url": "URL wurde in die Zwischenablage kopiert",

View File

@ -41,10 +41,14 @@
"gui_add": "Add",
"gui_delete": "Delete",
"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 expire automatically at {}",
"gui_share_start_server": "Start Sharing",
"gui_share_stop_server": "Stop Sharing",
"gui_share_stop_server_shutdown_timeout": "Stop Sharing ({}s remaining)",
"gui_share_stop_server_shutdown_timeout_tooltip": "Share will expire automatically at {}",
"gui_receive_start_server": "Start Receive Mode",
"gui_receive_stop_server": "Stop Receive Mode",
"gui_receive_stop_server_shutdown_timeout": "Stop Receive Mode ({}s remaining)",
"gui_receive_stop_server_shutdown_timeout_tooltip": "Receive mode will expire automatically at {}",
"gui_copy_url": "Copy Address",
"gui_copy_hidservauth": "Copy HidServAuth",
"gui_downloads": "Download History",

View File

@ -25,8 +25,8 @@
"gui_add": "Aldoni",
"gui_delete": "Forviŝi",
"gui_choose_items": "Elekti",
"gui_start_server": "Komenci kundividon",
"gui_stop_server": "Ĉesigi kundividon",
"gui_share_start_server": "Komenci kundividon",
"gui_share_stop_server": "Ĉesigi kundividon",
"gui_copy_url": "Kopii URL",
"gui_copy_hidservauth": "Kopii HidServAuth",
"gui_downloads": "Elŝutoj:",

View File

@ -24,8 +24,8 @@
"gui_add": "Añadir",
"gui_delete": "Eliminar",
"gui_choose_items": "Elegir",
"gui_start_server": "Encender el Servidor",
"gui_stop_server": "Detener el Servidor",
"gui_share_start_server": "Encender el Servidor",
"gui_share_stop_server": "Detener el Servidor",
"gui_copy_url": "Copiar URL",
"gui_downloads": "Descargas:",
"gui_copied_url": "Se copió la URL en el portapapeles"

View File

@ -26,8 +26,8 @@
"gui_add": "Lisää",
"gui_delete": "Poista",
"gui_choose_items": "Valitse",
"gui_start_server": "Käynnistä palvelin",
"gui_stop_server": "Pysäytä palvelin",
"gui_share_start_server": "Käynnistä palvelin",
"gui_share_stop_server": "Pysäytä palvelin",
"gui_copy_url": "Kopioi URL-osoite",
"gui_downloads": "Lataukset:",
"gui_canceled": "Peruutettu",

View File

@ -29,8 +29,8 @@
"gui_add": "Ajouter",
"gui_delete": "Supprimer",
"gui_choose_items": "Sélectionnez",
"gui_start_server": "Démarrer le serveur",
"gui_stop_server": "Arrêter le serveur",
"gui_share_start_server": "Démarrer le serveur",
"gui_share_stop_server": "Arrêter le serveur",
"gui_copy_url": "Copier URL",
"gui_copy_hidservauth": "Copier HidServAuth",
"gui_downloads": "Téléchargements :",

View File

@ -26,8 +26,8 @@
"gui_add": "Aggiungi",
"gui_delete": "Cancella",
"gui_choose_items": "Scegli",
"gui_start_server": "Inizia la condivisione",
"gui_stop_server": "Ferma la condivisione",
"gui_share_start_server": "Inizia la condivisione",
"gui_share_stop_server": "Ferma la condivisione",
"gui_copy_url": "Copia lo URL",
"gui_downloads": "Downloads:",
"gui_canceled": "Cancellati",

View File

@ -38,8 +38,6 @@
"gui_add": "Toevoegen",
"gui_delete": "Verwijder",
"gui_choose_items": "Kies",
"gui_start_server": "Start server",
"gui_stop_server": "Stop server",
"gui_copy_url": "Kopieer URL",
"gui_copy_hidservauth": "Kopieer HidServAuth",
"gui_downloads": "Downloads:",

View File

@ -26,8 +26,8 @@
"gui_add": "Ekle",
"gui_delete": "Sil",
"gui_choose_items": "Seç",
"gui_start_server": "Paylaşımı Başlat",
"gui_stop_server": "Paylaşımı Durdur",
"gui_share_start_server": "Paylaşımı Başlat",
"gui_share_stop_server": "Paylaşımı Durdur",
"gui_copy_url": "URL Kopyala",
"gui_downloads": "İndirilenler:",
"gui_canceled": "İptal edilen",