Skip to content

Commit caf8ba8

Browse files
committed
feat: add Preferences dialog with general and SmartProp configuration tabs
1 parent 4dfb9c1 commit caf8ba8

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/settings/main.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from src.widgets.common import Button # Using the internal Button class
1414
from src.styles.common import qt_stylesheet_checkbox, qt_stylesheet_combobox
1515
from src.widgets import FloatWidget # Using the internal FloatWidget for float properties
16+
from src.other.file_association import setup_all_associations
1617

1718

1819
class ActionButtonsPanel(QFrame):
@@ -127,6 +128,12 @@ def create_general_tab(self):
127128
self.checkBox_close_to_tray.setStyleSheet(qt_stylesheet_checkbox)
128129
row_app.addWidget(self.checkBox_close_to_tray)
129130
layout_other.addLayout(row_app)
131+
132+
# File association button in General -> Other
133+
self.btn_force_association = Button(text=" Force Associate File Extensions (.vsmart, .vsndevts, .hbat)")
134+
self.btn_force_association.set_icon_sync()
135+
layout_other.addWidget(self.btn_force_association)
136+
130137
layout.addWidget(self.frame_other)
131138
layout.addStretch()
132139
# Wrap the general tab content in a scroll area
@@ -185,7 +192,6 @@ def create_smartprop_tab(self):
185192
value=70)
186193
row_transparency.addWidget(self.spe_transparency_window)
187194
layout_rt_saving.addLayout(row_transparency)
188-
layout.addWidget(frame_rt_saving)
189195
# Relative Saving Delay row
190196
row_rt_delay = QHBoxLayout()
191197
label_rt_delay = QLabel("Realtime Saving Delay (milliseconds):", frame_rt_saving)
@@ -203,6 +209,8 @@ def create_smartprop_tab(self):
203209
)
204210
row_rt_delay.addWidget(self.spe_realtime_saving_delay)
205211
layout_rt_saving.addLayout(row_rt_delay)
212+
layout.addWidget(frame_rt_saving)
213+
206214

207215
layout.addStretch()
208216
smartprop_scroll = self.wrap_in_scroll_area(smartprop_content)
@@ -435,6 +443,7 @@ def connect_signals(self):
435443
self.spe_transparency_window.edited.connect(
436444
lambda val: set_settings_value('SmartPropEditor', 'transparency_window', str(val))
437445
)
446+
self.btn_force_association.clicked.connect(self.force_file_associations)
438447

439448
def browse_archive(self):
440449
selected_dir = QFileDialog.getExistingDirectory(self, "Select Archive Path", os.getcwd())
@@ -479,6 +488,10 @@ def check_update(self):
479488
self.action_buttons_panel.check_update_button.setEnabled(True)
480489
self.populate_preferences()
481490

491+
def force_file_associations(self):
492+
setup_all_associations(force=True, parent_window=self)
493+
QMessageBox.information(self, "File Associations", "File associations have been successfully updated.")
494+
482495

483496

484497
if __name__ == "__main__":

0 commit comments

Comments
 (0)