Edits to fast reg update

This commit is contained in:
Your Name 2025-08-25 11:48:31 +01:00
parent d66be255d3
commit 7d999a9f01

View file

@ -4240,6 +4240,42 @@ class EditorPage(Page):
# Establecer el ícono girado en el botón
prev_button.setIcon(QIcon(rotated_icon))
prev_button.setIconSize(prev_button.size())
print('the key is: ', key)
print('the connection manager is synced: ', self.connection_manager.is_synced())
if (key == 'location' or key == 'browser') and not self.connection_manager.is_synced():
w = prev_button.width()
h = prev_button.height()
outline_pix = QPixmap(w, h)
outline_pix.fill(Qt.GlobalColor.transparent)
painter = QPainter(outline_pix)
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
pen = QtGui.QPen(QColor(0, 255, 0))
pen.setWidth(3)
painter.setPen(pen)
painter.setBrush(Qt.BrushStyle.NoBrush)
left_points = [QPointF(w*0.65, h*0.15), QPointF(w*0.25, h*0.50), QPointF(w*0.65, h*0.85)]
painter.drawPolygon(QtGui.QPolygonF(left_points))
painter.end()
prev_button.setIcon(QIcon(outline_pix))
prev_button.setIconSize(prev_button.size())
# Apply green styling for location and browser buttons to indicate sync requirement
if (key == 'location' or key == 'browser') and not self.connection_manager.is_synced():
prev_button.setStyleSheet("""
QPushButton {
background-color: transparent;
border: none;
}
QPushButton:hover {
background-color: rgba(0, 255, 0, 0.1);
border-radius: 3px;
}
QPushButton:pressed {
background-color: rgba(0, 255, 0, 0.2);
border-radius: 3px;
}
""")
self.buttons.append(prev_button)
# Botón para mostrar el valor siguiente
@ -4250,6 +4286,40 @@ class EditorPage(Page):
self.buttons.append(next_button)
next_button.setIcon(QIcon( os.path.join(self.btn_path, f"UP_button.png")))
next_button.setIconSize(next_button.size())
if (key == 'location' or key == 'browser') and not self.connection_manager.is_synced():
w = next_button.width()
h = next_button.height()
outline_pix_r = QPixmap(w, h)
outline_pix_r.fill(Qt.GlobalColor.transparent)
painter_r = QPainter(outline_pix_r)
painter_r.setRenderHint(QPainter.RenderHint.Antialiasing)
pen_r = QtGui.QPen(QColor(0, 255, 0))
pen_r.setWidth(3)
painter_r.setPen(pen_r)
painter_r.setBrush(Qt.BrushStyle.NoBrush)
right_points = [QPointF(w*0.35, h*0.15), QPointF(w*0.75, h*0.50), QPointF(w*0.35, h*0.85)]
painter_r.drawPolygon(QtGui.QPolygonF(right_points))
painter_r.end()
next_button.setIcon(QIcon(outline_pix_r))
next_button.setIconSize(next_button.size())
# Apply green styling for location and browser buttons to indicate sync requirement
if (key == 'location' or key == 'browser') and not self.connection_manager.is_synced():
next_button.setStyleSheet("""
QPushButton {
background-color: transparent;
border: none;
}
QPushButton:hover {
background-color: rgba(0, 255, 0, 0.1);
border-radius: 3px;
}
QPushButton:pressed {
background-color: rgba(0, 255, 0, 0.2);
border-radius: 3px;
}
""")
prev_button.setVisible(True)
next_button.setVisible(True)
if key == 'protocol' or (protocol == 'wireguard' and key == 'connection'):
@ -4531,7 +4601,7 @@ class Settings(Page):
menu_items = [
("Overview", self.show_account_page),
("Subscriptions", self.show_subscription_page),
("Registrations", self.show_registrations_page),
("Create/Edit", self.show_registrations_page),
("Delete Profile", self.show_delete_page),
("Error Logs", self.show_logs_page)
]
@ -4897,6 +4967,12 @@ class Settings(Page):
self.subscription_info[key] = value_label
layout.addWidget(subscription_group)
clipboard_hint = QLabel("💡 Click on the billing code to copy it to clipboard")
clipboard_hint.setStyleSheet(f"color: #666666; font-size: 11px; font-style: italic; {self.font_style}")
clipboard_hint.setAlignment(Qt.AlignmentFlag.AlignCenter)
layout.addWidget(clipboard_hint)
layout.addStretch()
self.profile_selector.currentIndexChanged.connect(self.update_subscription_info)
@ -5247,11 +5323,11 @@ class Settings(Page):
registrations_group.setStyleSheet(f"QGroupBox {{ color: white; padding: 15px; {self.font_style} }}")
registrations_layout = QVBoxLayout(registrations_group)
self.enable_auto_sync = QCheckBox("Enable auto-sync")
self.enable_auto_sync = QCheckBox("Enable auto-sync on Edit")
self.enable_auto_sync.setStyleSheet(self.get_checkbox_style())
registrations_layout.addWidget(self.enable_auto_sync)
self.enable_fast_registration = QCheckBox("Enable fast registration")
self.enable_fast_registration = QCheckBox("Enable Fast-mode for Profile Creation")
self.enable_fast_registration.setStyleSheet(self.get_checkbox_style())
registrations_layout.addWidget(self.enable_fast_registration)
@ -5264,8 +5340,8 @@ class Settings(Page):
save_button.clicked.connect(self.save_registrations_settings)
button_layout = QHBoxLayout()
button_layout.addStretch()
button_layout.addWidget(save_button)
button_layout.addStretch()
layout.addLayout(button_layout)
layout.addStretch()
@ -6560,7 +6636,7 @@ class FastRegistrationPage(Page):
self.labels = []
self.buttons = []
self.title.setGeometry(550, 40, 250, 40)
self.title.setText("Fast Registration")
self.title.setText("Fast Creation")
self.button_apply.setVisible(True)
self.button_apply.clicked.connect(self.create_profile)
@ -6578,6 +6654,7 @@ class FastRegistrationPage(Page):
self.name_handle.setText("Profile Name:")
self.name = QLineEdit(self)
self.name.setPlaceholderText("Enter profile name")
self.name.setGeometry(265, 70, 190, 30)
self.name.setStyleSheet("color: cyan; border: transparent;")
@ -6967,12 +7044,14 @@ class FastRegistrationPage(Page):
if not self.selected_values['location']:
locations = self.connection_manager.get_location_list()
if locations:
self.selected_values['location'] = locations[0]
random_index = random.randint(0, len(locations) - 1)
self.selected_values['location'] = locations[random_index]
if not self.selected_values['browser']:
browsers = self.connection_manager.get_browser_list()
if browsers:
self.selected_values['browser'] = browsers[0]
random_index = random.randint(0, len(browsers) - 1)
self.selected_values['browser'] = browsers[random_index]
def get_next_available_profile_id(self) -> int:
profiles = ProfileController.get_all()