Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspaces stabilization #26643

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/framework/workspace/internal/workspaceconfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@

#include "global/configreader.h"

#include "workspacetypes.h"

using namespace muse;
using namespace muse::workspace;

static const muse::Settings::Key CURRENT_WORKSPACE("workspace", "workspace");

void WorkspaceConfiguration::init()
{
fileSystem()->makePath(userWorkspacesPath());

m_config = ConfigReader::read(":/configs/workspaces.cfg");

settings()->setDefaultValue(CURRENT_WORKSPACE, Val(defaultWorkspaceName()));
Expand Down
2 changes: 2 additions & 0 deletions src/framework/workspace/internal/workspaceconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@

#include "modularity/ioc.h"
#include "iglobalconfiguration.h"
#include "io/ifilesystem.h"

#include "../iworkspaceconfiguration.h"

namespace muse::workspace {
class WorkspaceConfiguration : public IWorkspaceConfiguration, public Injectable, public async::Asyncable
{
Inject<IGlobalConfiguration> globalConfiguration = { this };
Inject<io::IFileSystem> fileSystem = { this };

public:
WorkspaceConfiguration(const modularity::ContextPtr& iocCtx)
Expand Down
13 changes: 6 additions & 7 deletions src/framework/workspace/internal/workspacemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,16 +308,15 @@ io::paths_t WorkspaceManager::findWorkspaceFiles() const
};

io::paths_t builtinWorkspacesPaths = configuration()->builtinWorkspacesFilePaths();

io::paths_t userWorkspacesPaths = findFiles(configuration()->userWorkspacesPath());
std::set<io::path_t> userWorkspacesFileNames;
for (const io::path_t& dirPath : userWorkspacesPaths) {
userWorkspacesFileNames.insert(io::filename(dirPath));
std::set<io::path_t> builtinWorkspacesFileNames;
for (const io::path_t& dirPath : builtinWorkspacesPaths) {
builtinWorkspacesFileNames.insert(io::filename(dirPath));
}

muse::remove_if(builtinWorkspacesPaths, [=](const io::path_t& path) -> bool {
io::paths_t userWorkspacesPaths = findFiles(configuration()->userWorkspacesPath());
muse::remove_if(userWorkspacesPaths, [=](const io::path_t& path) -> bool {
io::path_t fileName = io::filename(path);
return muse::contains(userWorkspacesFileNames, fileName);
return muse::contains(builtinWorkspacesFileNames, fileName);
});

io::paths_t result;
Expand Down
4 changes: 4 additions & 0 deletions src/framework/workspace/internal/workspaceutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,9 @@ bool WorkspaceUtils::workspaceLessThan(const IWorkspacePtr& workspace1, const IW
return isWorkspace1Builtin;
}

if (isWorkspace1Builtin && isWorkspace2Builtin) {
return false;
}

return workspace1->name() < workspace2->name();
}
3 changes: 0 additions & 3 deletions src/framework/workspace/view/newworkspacemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
#include "global/translation.h"
#include "global/io/path.h"

#include "ui/uitypes.h"
#include "palette/palettetypes.h"

#include "log.h"

using namespace muse::workspace;
Expand Down
1 change: 0 additions & 1 deletion src/framework/workspace/workspacetypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

namespace muse::workspace {
using DataKey = const char*;
inline constexpr DataKey WS_Undefined("");
}

#endif // MUSE_WORKSPACE_WORKSPACETYPES_H
Loading