fix 2 more bugs related to edited workspaces
- Basic/Advanced positions in the workspaces combobox are mixed if Advanced workspace has been selected in Startup Wizard - Basic workspace appears as "edited" if we edit Advanced workspace (in case the latter has been selected in Startup Wizard)
This commit is contained in:
parent
9d1f5955b8
commit
aeaa2c8ac0
1 changed files with 22 additions and 20 deletions
|
@ -220,12 +220,11 @@ void MuseScore::changeWorkspace(const QString& name)
|
||||||
|
|
||||||
void MuseScore::changeWorkspace(Workspace* p, bool first)
|
void MuseScore::changeWorkspace(Workspace* p, bool first)
|
||||||
{
|
{
|
||||||
if (!first) {
|
if (!first)
|
||||||
WorkspacesManager::currentWorkspace()->save();
|
WorkspacesManager::currentWorkspace()->save();
|
||||||
if (WorkspacesManager::currentWorkspace())
|
|
||||||
disconnect(getPaletteWorkspace(), &PaletteWorkspace::userPaletteChanged, WorkspacesManager::currentWorkspace(), QOverload<>::of(&Workspace::setDirty));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (WorkspacesManager::currentWorkspace())
|
||||||
|
disconnect(getPaletteWorkspace(), &PaletteWorkspace::userPaletteChanged, WorkspacesManager::currentWorkspace(), QOverload<>::of(&Workspace::setDirty));
|
||||||
|
|
||||||
p->read();
|
p->read();
|
||||||
WorkspacesManager::setCurrentWorkspace(p);
|
WorkspacesManager::setCurrentWorkspace(p);
|
||||||
|
@ -1195,22 +1194,6 @@ void WorkspacesManager::initWorkspaces()
|
||||||
for (Workspace* old : oldWorkspaces)
|
for (Workspace* old : oldWorkspaces)
|
||||||
m_workspaces.removeOne(old);
|
m_workspaces.removeOne(old);
|
||||||
|
|
||||||
// Delete default workspaces if there are corresponding user-edited ones
|
|
||||||
m_visibleWorkspaces = m_workspaces;
|
|
||||||
for (Workspace* ew : editedWorkpaces) {
|
|
||||||
const QString uneditedName = defaultWorkspaceTranslatableName(ew->translatableName());
|
|
||||||
if (uneditedName.isEmpty())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (auto it = m_visibleWorkspaces.begin(); it != m_visibleWorkspaces.end(); ++it) {
|
|
||||||
Workspace* w = *it;
|
|
||||||
if (w->translatableName() == uneditedName) {
|
|
||||||
m_visibleWorkspaces.erase(it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_workspaces.empty())
|
if (m_workspaces.empty())
|
||||||
qFatal("No workspaces found");
|
qFatal("No workspaces found");
|
||||||
|
|
||||||
|
@ -1227,7 +1210,25 @@ void WorkspacesManager::initWorkspaces()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
retranslate(m_workspaces);
|
retranslate(m_workspaces);
|
||||||
|
|
||||||
|
// Delete default workspaces if there are corresponding user-edited ones
|
||||||
|
m_visibleWorkspaces = m_workspaces;
|
||||||
|
for (Workspace* ew : editedWorkpaces) {
|
||||||
|
const QString uneditedName = defaultWorkspaceTranslatableName(ew->translatableName());
|
||||||
|
if (uneditedName.isEmpty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (auto it = m_visibleWorkspaces.begin(); it != m_visibleWorkspaces.end(); ++it) {
|
||||||
|
Workspace* w = *it;
|
||||||
|
if (w->translatableName() == uneditedName) {
|
||||||
|
m_visibleWorkspaces.erase(it);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
isWorkspacesListDirty = false;
|
isWorkspacesListDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1285,6 +1286,7 @@ Workspace* WorkspacesManager::createNewWorkspace(const QString& name)
|
||||||
w->setSourceWorkspaceName(WorkspacesManager::currentWorkspace()->sourceWorkspace()->translatableName());
|
w->setSourceWorkspaceName(WorkspacesManager::currentWorkspace()->sourceWorkspace()->translatableName());
|
||||||
|
|
||||||
m_workspaces.append(w);
|
m_workspaces.append(w);
|
||||||
|
m_visibleWorkspaces.append(w);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue