mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-02 11:10:31 +03:00
Remember Project Tree View "Show Hidden Files" state between sessions.
This commit is contained in:
@@ -590,7 +590,8 @@ json AppConfig::saveNode( Node* node ) {
|
|||||||
void AppConfig::saveProject( std::string projectFolder, UICodeEditorSplitter* editorSplitter,
|
void AppConfig::saveProject( std::string projectFolder, UICodeEditorSplitter* editorSplitter,
|
||||||
const std::string& configPath, const ProjectConfig& docConfig,
|
const std::string& configPath, const ProjectConfig& docConfig,
|
||||||
const ProjectBuildConfiguration& buildConfig, bool onlyIfNeeded,
|
const ProjectBuildConfiguration& buildConfig, bool onlyIfNeeded,
|
||||||
bool sessionSnapshot, PluginManager* pluginManager ) {
|
bool sessionSnapshot, bool showHiddenFiles,
|
||||||
|
PluginManager* pluginManager ) {
|
||||||
FileSystem::dirAddSlashAtEnd( projectFolder );
|
FileSystem::dirAddSlashAtEnd( projectFolder );
|
||||||
std::string projectsPath( configPath + "projects" + FileSystem::getOSSlash() );
|
std::string projectsPath( configPath + "projects" + FileSystem::getOSSlash() );
|
||||||
if ( !FileSystem::fileExists( projectsPath ) )
|
if ( !FileSystem::fileExists( projectsPath ) )
|
||||||
@@ -599,6 +600,7 @@ void AppConfig::saveProject( std::string projectFolder, UICodeEditorSplitter* ed
|
|||||||
std::string projectCfgPath( projectsPath + hash.toHexString() + ".cfg" );
|
std::string projectCfgPath( projectsPath + hash.toHexString() + ".cfg" );
|
||||||
IniFile cfg( projectCfgPath, false );
|
IniFile cfg( projectCfgPath, false );
|
||||||
cfg.setValue( "path", "folder_path", projectFolder );
|
cfg.setValue( "path", "folder_path", projectFolder );
|
||||||
|
cfg.setValueB( "project_tree", "show_hidden_files", showHiddenFiles );
|
||||||
cfg.setValueB( "document", "use_global_settings", docConfig.useGlobalSettings );
|
cfg.setValueB( "document", "use_global_settings", docConfig.useGlobalSettings );
|
||||||
cfg.setValue( "document", "h_ext_language_type",
|
cfg.setValue( "document", "h_ext_language_type",
|
||||||
HExtLanguageTypeHelper::toString( docConfig.hExtLanguageType ) );
|
HExtLanguageTypeHelper::toString( docConfig.hExtLanguageType ) );
|
||||||
@@ -873,14 +875,17 @@ void AppConfig::loadDocuments( UICodeEditorSplitter* editorSplitter, json j,
|
|||||||
|
|
||||||
void AppConfig::loadProject( std::string projectFolder, UICodeEditorSplitter* editorSplitter,
|
void AppConfig::loadProject( std::string projectFolder, UICodeEditorSplitter* editorSplitter,
|
||||||
const std::string& configPath, ProjectConfig& docConfig,
|
const std::string& configPath, ProjectConfig& docConfig,
|
||||||
ecode::App* app, bool sessionSnapshot, PluginManager* pluginManager ) {
|
ecode::App* app, bool sessionSnapshot, bool& showHiddenFiles,
|
||||||
|
PluginManager* pluginManager ) {
|
||||||
FileSystem::dirAddSlashAtEnd( projectFolder );
|
FileSystem::dirAddSlashAtEnd( projectFolder );
|
||||||
std::string projectsPath( configPath + "projects" + FileSystem::getOSSlash() );
|
std::string projectsPath( configPath + "projects" + FileSystem::getOSSlash() );
|
||||||
MD5::Result hash = MD5::fromString( projectFolder );
|
MD5::Result hash = MD5::fromString( projectFolder );
|
||||||
std::string projectCfgPath( projectsPath + hash.toHexString() + ".cfg" );
|
std::string projectCfgPath( projectsPath + hash.toHexString() + ".cfg" );
|
||||||
|
showHiddenFiles = false;
|
||||||
if ( !FileSystem::fileExists( projectCfgPath ) )
|
if ( !FileSystem::fileExists( projectCfgPath ) )
|
||||||
return;
|
return;
|
||||||
IniFile cfg( projectCfgPath );
|
IniFile cfg( projectCfgPath );
|
||||||
|
showHiddenFiles = cfg.getValueB( "project_tree", "show_hidden_files", false );
|
||||||
|
|
||||||
docConfig.useGlobalSettings = cfg.getValueB( "document", "use_global_settings", true );
|
docConfig.useGlobalSettings = cfg.getValueB( "document", "use_global_settings", true );
|
||||||
|
|
||||||
|
|||||||
@@ -333,11 +333,11 @@ class AppConfig {
|
|||||||
void saveProject( std::string projectFolder, UICodeEditorSplitter* editorSplitter,
|
void saveProject( std::string projectFolder, UICodeEditorSplitter* editorSplitter,
|
||||||
const std::string& configPath, const ProjectConfig& docConfig,
|
const std::string& configPath, const ProjectConfig& docConfig,
|
||||||
const ProjectBuildConfiguration& buildConfig, bool onlyIfNeeded,
|
const ProjectBuildConfiguration& buildConfig, bool onlyIfNeeded,
|
||||||
bool sessionSnapshot, PluginManager* );
|
bool sessionSnapshot, bool showHiddenFiles, PluginManager* );
|
||||||
|
|
||||||
void loadProject( std::string projectFolder, UICodeEditorSplitter* editorSplitter,
|
void loadProject( std::string projectFolder, UICodeEditorSplitter* editorSplitter,
|
||||||
const std::string& configPath, ProjectConfig& docConfig, ecode::App* app,
|
const std::string& configPath, ProjectConfig& docConfig, ecode::App* app,
|
||||||
bool sessionSnapshot, PluginManager* pluginManager );
|
bool sessionSnapshot, bool& showHiddenFiles, PluginManager* pluginManager );
|
||||||
|
|
||||||
void addTabWidgetType( const std::string& type, TabWidgetCbs tabWidget ) {
|
void addTabWidgetType( const std::string& type, TabWidgetCbs tabWidget ) {
|
||||||
Lock l( tabWidgetTypesMutex );
|
Lock l( tabWidgetTypesMutex );
|
||||||
|
|||||||
@@ -2260,7 +2260,7 @@ void App::saveProject( bool onlyIfNeeded, bool sessionSnapshotEnabled ) {
|
|||||||
mCurrentProject, mSplitter, mConfigPath, mProjectDocConfig,
|
mCurrentProject, mSplitter, mConfigPath, mProjectDocConfig,
|
||||||
mProjectBuildManager ? mProjectBuildManager->getConfig() : ProjectBuildConfiguration(),
|
mProjectBuildManager ? mProjectBuildManager->getConfig() : ProjectBuildConfiguration(),
|
||||||
onlyIfNeeded, sessionSnapshotEnabled && mConfig.workspace.sessionSnapshot,
|
onlyIfNeeded, sessionSnapshotEnabled && mConfig.workspace.sessionSnapshot,
|
||||||
mPluginManager.get() );
|
mShowHiddenFiles, mPluginManager.get() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3685,11 +3685,12 @@ void App::openAllFilesInFolder( const FileInfo& folder ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void App::toggleHiddenFiles() {
|
void App::toggleHiddenFiles() {
|
||||||
|
mShowHiddenFiles = !mShowHiddenFiles;
|
||||||
mFileSystemModel = FileSystemModel::New( mFileSystemModel->getRootPath(),
|
mFileSystemModel = FileSystemModel::New( mFileSystemModel->getRootPath(),
|
||||||
FileSystemModel::Mode::FilesAndDirectories,
|
FileSystemModel::Mode::FilesAndDirectories,
|
||||||
{ true,
|
{ true,
|
||||||
true,
|
true,
|
||||||
!mFileSystemModel->getDisplayConfig().ignoreHidden,
|
!mShowHiddenFiles,
|
||||||
{},
|
{},
|
||||||
[this]( const std::string& filePath ) -> bool {
|
[this]( const std::string& filePath ) -> bool {
|
||||||
return isFileVisibleInTreeView( filePath );
|
return isFileVisibleInTreeView( filePath );
|
||||||
@@ -4223,7 +4224,8 @@ void App::loadFolder( std::string path, bool forceNewWindow ) {
|
|||||||
mProjectBuildManager =
|
mProjectBuildManager =
|
||||||
std::make_unique<ProjectBuildManager>( rpath, mThreadPool, mSidePanel, this );
|
std::make_unique<ProjectBuildManager>( rpath, mThreadPool, mSidePanel, this );
|
||||||
mConfig.loadProject( rpath, mSplitter, mConfigPath, mProjectDocConfig, this,
|
mConfig.loadProject( rpath, mSplitter, mConfigPath, mProjectDocConfig, this,
|
||||||
mConfig.workspace.sessionSnapshot, mPluginManager.get() );
|
mConfig.workspace.sessionSnapshot, mShowHiddenFiles,
|
||||||
|
mPluginManager.get() );
|
||||||
Log::info( "Load project took: %.2f ms", projClock.getElapsedTime().asMilliseconds() );
|
Log::info( "Load project took: %.2f ms", projClock.getElapsedTime().asMilliseconds() );
|
||||||
|
|
||||||
loadFileSystemMatcher( rpath );
|
loadFileSystemMatcher( rpath );
|
||||||
@@ -4231,7 +4233,7 @@ void App::loadFolder( std::string path, bool forceNewWindow ) {
|
|||||||
mFileSystemModel = FileSystemModel::New( rpath, FileSystemModel::Mode::FilesAndDirectories,
|
mFileSystemModel = FileSystemModel::New( rpath, FileSystemModel::Mode::FilesAndDirectories,
|
||||||
{ true,
|
{ true,
|
||||||
true,
|
true,
|
||||||
true,
|
!mShowHiddenFiles,
|
||||||
{},
|
{},
|
||||||
[this]( const std::string& filePath ) -> bool {
|
[this]( const std::string& filePath ) -> bool {
|
||||||
return isFileVisibleInTreeView( filePath );
|
return isFileVisibleInTreeView( filePath );
|
||||||
|
|||||||
@@ -728,6 +728,7 @@ class App : public UICodeEditorSplitter::Client, public PluginContextProvider {
|
|||||||
std::shared_ptr<GitIgnoreMatcher> mFileSystemMatcher;
|
std::shared_ptr<GitIgnoreMatcher> mFileSystemMatcher;
|
||||||
size_t mMenuIconSize{ 16 };
|
size_t mMenuIconSize{ 16 };
|
||||||
bool mDirTreeReady{ false };
|
bool mDirTreeReady{ false };
|
||||||
|
bool mShowHiddenFiles{ false };
|
||||||
bool mUseFrameBuffer{ false };
|
bool mUseFrameBuffer{ false };
|
||||||
bool mBenchmarkMode{ false };
|
bool mBenchmarkMode{ false };
|
||||||
bool mDisablePlugins{ false };
|
bool mDisablePlugins{ false };
|
||||||
|
|||||||
Reference in New Issue
Block a user