Shows the Main window before starting to connect to Tor on autoconnect enabled

This commit is contained in:
Saptak S 2021-12-03 19:30:20 +05:30
parent 51e49c01f1
commit 97a604a4c8
No known key found for this signature in database
GPG Key ID: 7B7F1772C0C6FCBF
4 changed files with 16 additions and 0 deletions

View File

@ -132,6 +132,11 @@ class AutoConnectTab(QtWidgets.QWidget):
self.setLayout(self.layout)
def check_autoconnect(self):
"""
After rendering, check if autoconnect was clicked, then start connecting
"""
self.common.log("AutoConnectTab", "autoconnect_checking")
if self.auto_connect_enabled:
self.enable_autoconnect_checkbox.setCheckState(QtCore.Qt.Checked)
self.connect_clicked()

View File

@ -174,6 +174,9 @@ class MainWindow(QtWidgets.QMainWindow):
)
self.close_dialog.setDefaultButton(self.close_dialog.reject_button)
# Check for autoconnect
self.tabs.check_autoconnect_tab()
def tor_connection_canceled(self):
"""
If the user cancels before Tor finishes connecting, ask if they want to

View File

@ -168,6 +168,10 @@ class TabWidget(QtWidgets.QTabWidget):
self.add_tab()
else:
self.open_connection_tab()
def check_autoconnect_tab(self):
if type(self.tabs[0]) is AutoConnectTab:
self.tabs[0].check_autoconnect()
def load_tab(self, mode_settings_id):
# Load the tab's mode settings

View File

@ -409,6 +409,10 @@ class TorSettingsTab(QtWidgets.QWidget):
self.old_settings = Settings(self.common)
self.old_settings.load()
# Check if autoconnect was enabled
if self.old_settings.get("auto_connect"):
self.autoconnect_checkbox.setCheckState(QtCore.Qt.Checked)
connection_type = self.old_settings.get("connection_type")
if connection_type == "bundled":
if self.connection_type_bundled_radio.isEnabled():