Change "Single Instance" to "Open Files in New Window".

This commit is contained in:
Martín Lucas Golini
2024-10-03 00:22:45 -03:00
parent d4187fcdab
commit e7f4c6fa45
4 changed files with 12 additions and 13 deletions

View File

@@ -117,7 +117,7 @@ void AppConfig::load( const std::string& confPath, std::string& keybindingsPath,
ui.showStatusBar = ini.getValueB( "ui", "show_status_bar", true );
ui.showMenuBar = ini.getValueB( "ui", "show_menu_bar", false );
ui.welcomeScreen = ini.getValueB( "ui", "welcome_screen", true );
ui.singleInstance = ini.getValueB( "ui", "single_instance", true );
ui.openFilesInNewWindow = ini.getValueB( "ui", "open_files_in_new_window", false );
ui.panelPosition = panelPositionFromString( ini.getValue( "ui", "panel_position", "left" ) );
ui.serifFont = ini.getValue( "ui", "serif_font", "fonts/NotoSans-Regular.ttf" );
ui.monospaceFont = ini.getValue( "ui", "monospace_font", "fonts/DejaVuSansMono.ttf" );
@@ -275,7 +275,7 @@ void AppConfig::save( const std::vector<std::string>& recentFiles,
ini.setValueB( "ui", "show_status_bar", ui.showStatusBar );
ini.setValueB( "ui", "show_menu_bar", ui.showMenuBar );
ini.setValueB( "ui", "welcome_screen", ui.welcomeScreen );
ini.setValueB( "ui", "single_instance", ui.singleInstance );
ini.setValueB( "ui", "open_files_in_new_window", ui.openFilesInNewWindow );
ini.setValue( "ui", "panel_position", panelPositionToString( ui.panelPosition ) );
ini.setValue( "ui", "serif_font", ui.serifFont );
ini.setValue( "ui", "monospace_font", ui.monospaceFont );

View File

@@ -33,7 +33,7 @@ struct UIConfig {
bool showStatusBar{ true };
bool showMenuBar{ false };
bool welcomeScreen{ true };
bool singleInstance{ true };
bool openFilesInNewWindow{ false };
PanelPosition panelPosition{ PanelPosition::Left };
std::string serifFont;
std::string monospaceFont;

View File

@@ -3084,7 +3084,7 @@ FontTrueType* App::loadFont( const std::string& name, std::string fontPath,
}
bool App::needsRedirectToRunningProcess( std::string file ) {
if ( !mConfig.ui.singleInstance || file.empty() )
if ( mConfig.ui.openFilesInNewWindow || file.empty() )
return false;
bool hasPosition = pathHasPosition( file );

View File

@@ -1170,13 +1170,12 @@ UIMenu* SettingsMenu::createWindowMenu() {
mWindowMenu->addSeparator();
mWindowMenu
->addCheckBox( i18n( "single_instance_enable", "Enable Single Instance" ),
mApp->getConfig().ui.singleInstance )
->setTooltipText(
i18n( "single_instance_desc",
"Newly opened files will be opened in the latest opened ecode instance." ) )
->setId( "single-instance-enable" );
->addCheckBox( i18n( "open_files_in_new_window_enable", "Open Files in New Window" ),
mApp->getConfig().ui.openFilesInNewWindow )
->setTooltipText( i18n( "open_files_in_new_window_desc",
"When files are opened from a file explorer or from the command "
"line, this\ncontrols whether a new window is created or not." ) )
->setId( "open-files-in-new-window-enable" );
mWindowMenu
->addCheckBox( i18n( "welcome_screen_enable", "Enable Welcome Screen" ),
mApp->getConfig().ui.welcomeScreen )
@@ -1195,9 +1194,9 @@ UIMenu* SettingsMenu::createWindowMenu() {
} else if ( "welcome-screen-enable" == item->getId() ) {
bool active = item->asType<UIMenuCheckBox>()->isActive();
mApp->getConfig().ui.welcomeScreen = active;
} else if ( "single-instance-enable" == item->getId() ) {
} else if ( "open-files-in-new-window-enable" == item->getId() ) {
bool active = item->asType<UIMenuCheckBox>()->isActive();
mApp->getConfig().ui.singleInstance = active;
mApp->getConfig().ui.openFilesInNewWindow = active;
mApp->saveConfig();
} else {
String text = String( event->getNode()->asType<UIMenuItem>()->getId() ).toLower();