8787from src .qt .modals .fix_dupes import FixDupeFilesModal
8888from src .qt .modals .fix_unlinked import FixUnlinkedEntriesModal
8989from src .qt .modals .folders_to_tags import FoldersToTagsModal
90+ from src .qt .modals .settings_panel import SettingsPanel
9091from src .qt .modals .tag_color_manager import TagColorManager
9192from src .qt .modals .tag_database import TagDatabasePanel
9293from src .qt .modals .tag_search import TagSearchPanel
@@ -197,6 +198,10 @@ def __init__(self, backend, args):
197198 )
198199 self .config_path = self .settings .fileName ()
199200
201+ Translations .change_language (
202+ str (self .settings .value (SettingItems .LANGUAGE , defaultValue = "en" , type = str ))
203+ )
204+
200205 # NOTE: This should be a per-library setting rather than an application setting.
201206 thumb_cache_size_limit : int = int (
202207 str (
@@ -366,19 +371,6 @@ def start(self) -> None:
366371 file_menu .addMenu (self .open_recent_library_menu )
367372 self .update_recent_lib_menu ()
368373
369- open_on_start_action = QAction (self )
370- Translations .translate_qobject (open_on_start_action , "settings.open_library_on_start" )
371- open_on_start_action .setCheckable (True )
372- open_on_start_action .setChecked (
373- bool (self .settings .value (SettingItems .START_LOAD_LAST , defaultValue = True , type = bool ))
374- )
375- open_on_start_action .triggered .connect (
376- lambda checked : self .settings .setValue (SettingItems .START_LOAD_LAST , checked )
377- )
378- file_menu .addAction (open_on_start_action )
379-
380- file_menu .addSeparator ()
381-
382374 self .save_library_backup_action = QAction (menu_bar )
383375 Translations .translate_qobject (self .save_library_backup_action , "menu.file.save_backup" )
384376 self .save_library_backup_action .triggered .connect (
@@ -397,6 +389,23 @@ def start(self) -> None:
397389 self .save_library_backup_action .setEnabled (False )
398390 file_menu .addAction (self .save_library_backup_action )
399391
392+ file_menu .addSeparator ()
393+ settings_action = QAction (self )
394+ Translations .translate_qobject (settings_action , "menu.settings" )
395+ settings_action .triggered .connect (self .open_settings_modal )
396+ file_menu .addAction (settings_action )
397+
398+ open_on_start_action = QAction (self )
399+ Translations .translate_qobject (open_on_start_action , "settings.open_library_on_start" )
400+ open_on_start_action .setCheckable (True )
401+ open_on_start_action .setChecked (
402+ bool (self .settings .value (SettingItems .START_LOAD_LAST , defaultValue = True , type = bool ))
403+ )
404+ open_on_start_action .triggered .connect (
405+ lambda checked : self .settings .setValue (SettingItems .START_LOAD_LAST , checked )
406+ )
407+ file_menu .addAction (open_on_start_action )
408+
400409 file_menu .addSeparator ()
401410
402411 self .refresh_dir_action = QAction (menu_bar )
@@ -1830,6 +1839,24 @@ def clear_recent_libs(self):
18301839 self .settings .sync ()
18311840 self .update_recent_lib_menu ()
18321841
1842+ def open_settings_modal (self ):
1843+ # TODO: Implement a proper settings panel, and don't re-create it each time it's opened.
1844+ settings_panel = SettingsPanel (self )
1845+ modal = PanelModal (
1846+ widget = settings_panel ,
1847+ done_callback = lambda : self .update_language_settings (settings_panel .get_language ()),
1848+ has_save = False ,
1849+ )
1850+ Translations .translate_with_setter (modal .setTitle , "settings.title" )
1851+ Translations .translate_with_setter (modal .setWindowTitle , "settings.title" )
1852+ modal .show ()
1853+
1854+ def update_language_settings (self , language : str ):
1855+ Translations .change_language (language )
1856+
1857+ self .settings .setValue (SettingItems .LANGUAGE , language )
1858+ self .settings .sync ()
1859+
18331860 def open_library (self , path : Path ) -> None :
18341861 """Open a TagStudio library."""
18351862 translation_params = {"key" : "splash.opening_library" , "library_path" : str (path )}
0 commit comments