diff --git a/install/onionshare.nsi b/install/onionshare.nsi
index 4030636a..f47541cf 100644
--- a/install/onionshare.nsi
+++ b/install/onionshare.nsi
@@ -207,6 +207,8 @@ Section "install"
File "${BINPATH}\share\images\download_completed_none.png"
File "${BINPATH}\share\images\download_in_progress.png"
File "${BINPATH}\share\images\download_in_progress_none.png"
+ File "${BINPATH}\share\images\download_window_gray.png"
+ File "${BINPATH}\share\images\download_window_green.png"
File "${BINPATH}\share\images\favicon.ico"
File "${BINPATH}\share\images\file_delete.png"
File "${BINPATH}\share\images\info.png"
@@ -393,6 +395,8 @@ FunctionEnd
Delete "$INSTDIR\share\images\download_completed_none.png"
Delete "$INSTDIR\share\images\download_in_progress.png"
Delete "$INSTDIR\share\images\download_in_progress_none.png"
+ Delete "$INSTDIR\share\images\download_window_gray.png"
+ Delete "$INSTDIR\share\images\download_window_green.png"
Delete "$INSTDIR\share\images\favicon.ico"
Delete "$INSTDIR\share\images\file_delete.png"
Delete "$INSTDIR\share\images\info.png"
diff --git a/onionshare_gui/downloads.py b/onionshare_gui/downloads.py
index 166f14a4..5f82e8ba 100644
--- a/onionshare_gui/downloads.py
+++ b/onionshare_gui/downloads.py
@@ -19,7 +19,7 @@ along with this program. If not, see .
"""
import time
-from PyQt5 import QtCore, QtWidgets
+from PyQt5 import QtCore, QtWidgets, QtGui
from onionshare import strings, common
@@ -98,19 +98,39 @@ class Downloads(QtWidgets.QWidget):
def __init__(self):
super(Downloads, self).__init__()
self.downloads = {}
+
+ self.downloads_container = QtWidgets.QScrollArea()
+ self.downloads_container.setWidget(self)
+ self.downloads_container.setWindowTitle(strings._('gui_downloads', True))
+ self.downloads_container.setWidgetResizable(True)
+ self.downloads_container.setMaximumHeight(600)
+ self.downloads_container.setMinimumHeight(150)
+ self.downloads_container.setMinimumWidth(350)
+ self.downloads_container.setWindowIcon(QtGui.QIcon(common.get_resource_path('images/logo.png')))
+ self.downloads_container.setWindowFlags(QtCore.Qt.Sheet | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.CustomizeWindowHint)
+ self.downloads_container.vbar = self.downloads_container.verticalScrollBar()
+
+ self.downloads_label = QtWidgets.QLabel(strings._('gui_downloads', True))
+ self.downloads_label.setStyleSheet('QLabel { font-weight: bold; font-size 14px; text-align: center; }')
+ self.no_downloads_label = QtWidgets.QLabel(strings._('gui_no_downloads', True))
+
+ self.downloads_layout = QtWidgets.QVBoxLayout()
+
self.layout = QtWidgets.QVBoxLayout()
+ self.layout.addWidget(self.downloads_label)
+ self.layout.addWidget(self.no_downloads_label)
+ self.layout.addLayout(self.downloads_layout)
+ self.layout.addStretch()
self.setLayout(self.layout)
def add_download(self, download_id, total_bytes):
"""
Add a new download progress bar.
"""
- self.parent().show()
-
# add it to the list
download = Download(download_id, total_bytes)
self.downloads[download_id] = download
- self.layout.insertWidget(-1, download.progress_bar)
+ self.downloads_layout.addWidget(download.progress_bar)
def update_download(self, download_id, downloaded_bytes):
"""
@@ -129,6 +149,6 @@ class Downloads(QtWidgets.QWidget):
Reset the downloads back to zero
"""
for download in self.downloads.values():
- self.layout.removeWidget(download.progress_bar)
+ self.downloads_layout.removeWidget(download.progress_bar)
download.progress_bar.close()
self.downloads = {}
diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py
index 7dd641dd..02cdf992 100644
--- a/onionshare_gui/onionshare_gui.py
+++ b/onionshare_gui/onionshare_gui.py
@@ -103,13 +103,6 @@ class OnionShareGui(QtWidgets.QMainWindow):
# Downloads
self.downloads = Downloads()
- self.downloads_container = QtWidgets.QScrollArea()
- self.downloads_container.setWidget(self.downloads)
- self.downloads_container.setWidgetResizable(True)
- self.downloads_container.setMaximumHeight(200)
- self.downloads_container.setMinimumHeight(75)
- self.vbar = self.downloads_container.verticalScrollBar()
- self.downloads_container.hide() # downloads start out hidden
self.new_download = False
self.downloads_in_progress = 0
self.downloads_completed = 0
@@ -119,6 +112,12 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.info_label = QtWidgets.QLabel()
self.info_label.setStyleSheet('QLabel { font-size: 12px; color: #666666; }')
+ self.info_show_downloads = QtWidgets.QToolButton()
+ self.info_show_downloads.setIcon(QtGui.QIcon(common.get_resource_path('images/download_window_gray.png')))
+ self.info_show_downloads.setCheckable(True)
+ self.info_show_downloads.toggled.connect(self.downloads_toggled)
+ self.info_show_downloads.setToolTip(strings._('gui_downloads_window_tooltip', True))
+
self.info_in_progress_downloads_count = QtWidgets.QLabel()
self.info_in_progress_downloads_count.setStyleSheet('QLabel { font-size: 12px; color: #666666; }')
@@ -132,6 +131,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.info_layout.addStretch()
self.info_layout.addWidget(self.info_in_progress_downloads_count)
self.info_layout.addWidget(self.info_completed_downloads_count)
+ self.info_layout.addWidget(self.info_show_downloads)
self.info_widget = QtWidgets.QWidget()
self.info_widget.setLayout(self.info_layout)
@@ -189,7 +189,6 @@ class OnionShareGui(QtWidgets.QMainWindow):
primary_action_layout = QtWidgets.QVBoxLayout()
primary_action_layout.addWidget(self.server_status)
primary_action_layout.addWidget(self.filesize_warning)
- primary_action_layout.addWidget(self.downloads_container)
self.primary_action = QtWidgets.QWidget()
self.primary_action.setLayout(primary_action_layout)
self.primary_action.hide()
@@ -370,7 +369,6 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.app.set_stealth(self.settings.get('use_stealth'))
# Hide and reset the downloads if we have previously shared
- self.downloads_container.hide()
self.downloads.reset_downloads()
self.reset_info_counters()
self.status_bar.clearMessage()
@@ -562,7 +560,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
# scroll to the bottom of the dl progress bar log pane
# if a new download has been added
if self.new_download:
- self.vbar.setValue(self.vbar.maximum())
+ self.downloads.downloads_container.vbar.setValue(self.downloads.downloads_container.vbar.maximum())
self.new_download = False
events = []
@@ -580,7 +578,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.status_bar.showMessage(strings._('download_page_loaded', True))
elif event["type"] == web.REQUEST_DOWNLOAD:
- self.downloads_container.show() # show the downloads layout
+ self.downloads.no_downloads_label.hide()
self.downloads.add_download(event["data"]["id"], web.zip_filesize)
self.new_download = True
self.downloads_in_progress += 1
@@ -647,6 +645,16 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.status_bar.clearMessage()
self.server_share_status_label.setText(strings._('timeout_download_still_running', True))
+ def downloads_toggled(self, checked):
+ """
+ When the 'Show/hide downloads' button is toggled, show or hide the downloads window.
+ """
+ common.log('OnionShareGui', 'toggle_downloads')
+ if checked:
+ self.downloads.downloads_container.show()
+ else:
+ self.downloads.downloads_container.hide()
+
def copy_url(self):
"""
When the URL gets copied to the clipboard, display this in the status bar.
@@ -687,6 +695,9 @@ class OnionShareGui(QtWidgets.QMainWindow):
"""
self.update_downloads_completed(0)
self.update_downloads_in_progress(0)
+ self.info_show_downloads.setIcon(QtGui.QIcon(common.get_resource_path('images/download_window_gray.png')))
+ self.downloads.no_downloads_label.show()
+ self.downloads.downloads_container.resize(self.downloads.downloads_container.sizeHint())
def update_downloads_completed(self, count):
"""
@@ -707,6 +718,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.info_in_progress_downloads_image = common.get_resource_path('images/download_in_progress_none.png')
else:
self.info_in_progress_downloads_image = common.get_resource_path('images/download_in_progress.png')
+ self.info_show_downloads.setIcon(QtGui.QIcon(common.get_resource_path('images/download_window_green.png')))
self.info_in_progress_downloads_count.setText('
{1:d}'.format(self.info_in_progress_downloads_image, count))
self.info_in_progress_downloads_count.setToolTip(strings._('info_in_progress_downloads_tooltip', True).format(count))
diff --git a/share/images/download_window_gray.png b/share/images/download_window_gray.png
new file mode 100644
index 00000000..bf9c168e
Binary files /dev/null and b/share/images/download_window_gray.png differ
diff --git a/share/images/download_window_green.png b/share/images/download_window_green.png
new file mode 100644
index 00000000..8f9a899b
Binary files /dev/null and b/share/images/download_window_green.png differ
diff --git a/share/locale/en.json b/share/locale/en.json
index fe5f030a..10493933 100644
--- a/share/locale/en.json
+++ b/share/locale/en.json
@@ -44,7 +44,9 @@
"gui_stop_server_shutdown_timeout_tooltip": "Share will stop automatically at {}",
"gui_copy_url": "Copy Address",
"gui_copy_hidservauth": "Copy HidServAuth",
- "gui_downloads": "Downloads:",
+ "gui_downloads": "Download History",
+ "gui_downloads_window_tooltip": "Show/hide downloads",
+ "gui_no_downloads": "No downloads yet.",
"gui_canceled": "Canceled",
"gui_copied_url_title": "Copied OnionShare address",
"gui_copied_url": "The OnionShare address has been copied to clipboard",