diff --git a/onionshare_gui/gui_common.py b/onionshare_gui/gui_common.py index 47ffd787..bf05dac0 100644 --- a/onionshare_gui/gui_common.py +++ b/onionshare_gui/gui_common.py @@ -214,6 +214,21 @@ class GuiCommon: QLabel { color: #cc0000; }""", + # New tab + "new_tab_button_image": """ + QLabel { + padding: 30px; + } + """, + "new_tab_button_text": """ + QLabel { + border: 1px solid #efeff0; + border-radius: 4px; + background-color: #ffffff; + text-align: center; + color: #4e0d4e; + } + """, # Share mode and child widget styles "share_delete_all_files_button": """ QPushButton { diff --git a/onionshare_gui/tab/tab.py b/onionshare_gui/tab/tab.py index 4f006949..66cefdb0 100644 --- a/onionshare_gui/tab/tab.py +++ b/onionshare_gui/tab/tab.py @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ import queue -from PyQt5 import QtCore, QtWidgets, QtGui +from PyQt5 import QtCore, QtWidgets, QtGui, QtSvg from onionshare import strings from onionshare.onionshare import OnionShare @@ -35,6 +35,35 @@ from .server_status import ServerStatus from ..widgets import Alert +class NewTabButton(QtWidgets.QPushButton): + def __init__(self, common, image_filename, text): + super(NewTabButton, self).__init__() + self.common = common + + self.setFixedSize(280, 280) + + # Image + self.image_label = QtWidgets.QLabel(parent=self) + self.image_label.setPixmap( + QtGui.QPixmap.fromImage( + QtGui.QImage(self.common.get_resource_path(image_filename)) + ) + ) + self.image_label.setFixedSize(280, 280) + self.image_label.setStyleSheet(self.common.gui.css["new_tab_button_image"]) + self.image_label.setGeometry(0, 0, self.width(), self.height()) + self.image_label.show() + + # Text + self.text_label = QtWidgets.QLabel(text, parent=self) + self.text_label.setAlignment(QtCore.Qt.AlignCenter) + self.text_label.setStyleSheet(self.common.gui.css["new_tab_button_text"]) + self.text_label.setGeometry( + (self.width() - 200) / 2, self.height() - 40, 200, 30 + ) + self.text_label.show() + + class Tab(QtWidgets.QWidget): """ A GUI tab, you know, sort of like in a web browser @@ -67,69 +96,55 @@ class Tab(QtWidgets.QWidget): # Start the OnionShare app self.app = OnionShare(common, self.common.gui.onion, self.common.gui.local_only) - # Widgets to display on a new tab - self.share_button = QtWidgets.QPushButton(strings._("gui_new_tab_share_button")) - self.share_button.setStyleSheet(self.common.gui.css["mode_new_tab_button"]) - share_description = QtWidgets.QLabel(strings._("gui_new_tab_share_description")) - share_description.setWordWrap(True) + # New tab buttons + self.share_button = NewTabButton( + self.common, + "images/mode_new_tab_share.png", + strings._("gui_new_tab_share_button"), + ) self.share_button.clicked.connect(self.share_mode_clicked) - self.receive_button = QtWidgets.QPushButton( - strings._("gui_new_tab_receive_button") + self.receive_button = NewTabButton( + self.common, + "images/mode_new_tab_receive.png", + strings._("gui_new_tab_receive_button"), ) - self.receive_button.setStyleSheet(self.common.gui.css["mode_new_tab_button"]) self.receive_button.clicked.connect(self.receive_mode_clicked) - receive_description = QtWidgets.QLabel( - strings._("gui_new_tab_receive_description") - ) - receive_description.setWordWrap(True) - self.website_button = QtWidgets.QPushButton( - strings._("gui_new_tab_website_button") + self.website_button = NewTabButton( + self.common, + "images/mode_new_tab_website.png", + strings._("gui_new_tab_website_button"), ) - self.website_button.setStyleSheet(self.common.gui.css["mode_new_tab_button"]) self.website_button.clicked.connect(self.website_mode_clicked) - website_description = QtWidgets.QLabel( - strings._("gui_new_tab_website_description") - ) - website_description.setWordWrap(True) - self.chat_button = QtWidgets.QPushButton( - strings._("gui_new_tab_chat_button") + self.chat_button = NewTabButton( + self.common, + "images/mode_new_tab_chat.png", + strings._("gui_new_tab_chat_button"), ) - self.chat_button.setStyleSheet(self.common.gui.css["mode_new_tab_button"]) self.chat_button.clicked.connect(self.chat_mode_clicked) - chat_description = QtWidgets.QLabel( - strings._("gui_new_tab_chat_description") - ) - chat_description.setWordWrap(True) + + new_tab_top_layout = QtWidgets.QHBoxLayout() + new_tab_top_layout.addStretch() + new_tab_top_layout.addWidget(self.share_button) + new_tab_top_layout.addWidget(self.receive_button) + new_tab_top_layout.addStretch() + + new_tab_bottom_layout = QtWidgets.QHBoxLayout() + new_tab_bottom_layout.addStretch() + new_tab_bottom_layout.addWidget(self.website_button) + new_tab_bottom_layout.addWidget(self.chat_button) + new_tab_bottom_layout.addStretch() new_tab_layout = QtWidgets.QVBoxLayout() - new_tab_layout.addStretch(1) - new_tab_layout.addWidget(self.share_button) - new_tab_layout.addWidget(share_description) - new_tab_layout.addSpacing(50) - new_tab_layout.addWidget(self.receive_button) - new_tab_layout.addWidget(receive_description) - new_tab_layout.addSpacing(50) - new_tab_layout.addWidget(self.website_button) - new_tab_layout.addWidget(website_description) - new_tab_layout.addSpacing(50) - new_tab_layout.addWidget(self.chat_button) - new_tab_layout.addWidget(chat_description) - new_tab_layout.addStretch(3) - - new_tab_inner = QtWidgets.QWidget() - new_tab_inner.setFixedWidth(500) - new_tab_inner.setLayout(new_tab_layout) - - new_tab_outer_layout = QtWidgets.QHBoxLayout() - new_tab_outer_layout.addStretch() - new_tab_outer_layout.addWidget(new_tab_inner) - new_tab_outer_layout.addStretch() + new_tab_layout.addStretch() + new_tab_layout.addLayout(new_tab_top_layout) + new_tab_layout.addLayout(new_tab_bottom_layout) + new_tab_layout.addStretch() self.new_tab = QtWidgets.QWidget() - self.new_tab.setLayout(new_tab_outer_layout) + self.new_tab.setLayout(new_tab_layout) self.new_tab.show() # Layout @@ -313,16 +328,12 @@ class Tab(QtWidgets.QWidget): self.chat_mode.start_server_finished.connect( self.update_server_status_indicator ) - self.chat_mode.stop_server_finished.connect( - self.update_server_status_indicator - ) + self.chat_mode.stop_server_finished.connect(self.update_server_status_indicator) self.chat_mode.stop_server_finished.connect(self.stop_server_finished) self.chat_mode.start_server_finished.connect(self.clear_message) self.chat_mode.server_status.button_clicked.connect(self.clear_message) self.chat_mode.server_status.url_copied.connect(self.copy_url) - self.chat_mode.server_status.hidservauth_copied.connect( - self.copy_hidservauth - ) + self.chat_mode.server_status.hidservauth_copied.connect(self.copy_hidservauth) self.change_title.emit(self.tab_id, strings._("gui_new_tab_chat_button")) diff --git a/share/images/mode_chat.png b/share/images/mode_chat.png new file mode 100644 index 00000000..2d8d17c7 Binary files /dev/null and b/share/images/mode_chat.png differ diff --git a/share/images/mode_chat.svg b/share/images/mode_chat.svg new file mode 100644 index 00000000..335e9cf4 --- /dev/null +++ b/share/images/mode_chat.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/share/images/mode_new_tab_chat.png b/share/images/mode_new_tab_chat.png new file mode 100644 index 00000000..4d54f127 Binary files /dev/null and b/share/images/mode_new_tab_chat.png differ diff --git a/share/images/mode_new_tab_receive.png b/share/images/mode_new_tab_receive.png new file mode 100644 index 00000000..fe46f5ff Binary files /dev/null and b/share/images/mode_new_tab_receive.png differ diff --git a/share/images/mode_new_tab_share.png b/share/images/mode_new_tab_share.png new file mode 100644 index 00000000..bb33318c Binary files /dev/null and b/share/images/mode_new_tab_share.png differ diff --git a/share/images/mode_new_tab_website.png b/share/images/mode_new_tab_website.png new file mode 100644 index 00000000..08cc24a5 Binary files /dev/null and b/share/images/mode_new_tab_website.png differ diff --git a/share/images/mode_receive.png b/share/images/mode_receive.png new file mode 100644 index 00000000..b76c066f Binary files /dev/null and b/share/images/mode_receive.png differ diff --git a/share/images/mode_receive.svg b/share/images/mode_receive.svg new file mode 100644 index 00000000..5a0a29fd --- /dev/null +++ b/share/images/mode_receive.svg @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/share/images/mode_share.png b/share/images/mode_share.png new file mode 100644 index 00000000..a1ca2abf Binary files /dev/null and b/share/images/mode_share.png differ diff --git a/share/images/mode_share.svg b/share/images/mode_share.svg new file mode 100644 index 00000000..9fb97c65 --- /dev/null +++ b/share/images/mode_share.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/share/images/mode_website.png b/share/images/mode_website.png new file mode 100644 index 00000000..b146f451 Binary files /dev/null and b/share/images/mode_website.png differ diff --git a/share/images/mode_website.svg b/share/images/mode_website.svg new file mode 100644 index 00000000..1a80846f --- /dev/null +++ b/share/images/mode_website.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/share/locale/en.json b/share/locale/en.json index ab7e92aa..dc2f5208 100644 --- a/share/locale/en.json +++ b/share/locale/en.json @@ -185,13 +185,9 @@ "gui_new_tab": "New Tab", "gui_new_tab_tooltip": "Open a new tab", "gui_new_tab_share_button": "Share Files", - "gui_new_tab_share_description": "Choose files on your computer to send to someone else. The person or people who you want to send files to will need to use Tor Browser to download them from you.", "gui_new_tab_receive_button": "Receive Files", - "gui_new_tab_receive_description": "Turn your computer into an online dropbox. People will be able to use Tor Browser to send files to your computer.", - "gui_new_tab_website_button": "Publish Website", - "gui_new_tab_website_description": "Host a static HTML onion website from your computer.", - "gui_new_tab_chat_button": "Start Chat Server", - "gui_new_tab_chat_description": "Start an onion chat server and use it to chat in Tor Browser.", + "gui_new_tab_website_button": "Host a Website", + "gui_new_tab_chat_button": "Chat Anonymously", "gui_close_tab_warning_title": "Are you sure?", "gui_close_tab_warning_persistent_description": "This tab is persistent. If you close it you'll lose the onion address that it's using. Are you sure you want to close it?", "gui_close_tab_warning_share_description": "You're in the process of sending files. Are you sure you want to close this tab?",