Activate Shared Layout if it is not loaded yet

pull/5/head
Michail Vourlakos 6 years ago
parent e7568c8478
commit b33f29bc42

@ -199,7 +199,7 @@ QString CentralLayout::sharedLayoutName() const
void CentralLayout::setSharedLayoutName(QString name) void CentralLayout::setSharedLayoutName(QString name)
{ {
if (m_sharedLayoutName == name || !Importer::layoutExists(name)) { if (m_sharedLayoutName == name || (!Importer::layoutExists(name) && !name.isEmpty())) {
return; return;
} }

@ -1599,7 +1599,7 @@ bool SettingsDialog::saveAllChanges()
for (const auto &newLayoutName : activeLayoutsToRename.keys()) { for (const auto &newLayoutName : activeLayoutsToRename.keys()) {
Layout::GenericLayout *layout = activeLayoutsToRename[newLayoutName]; Layout::GenericLayout *layout = activeLayoutsToRename[newLayoutName];
qDebug() << " Active Layout of Type: " << layout->type() << " Is Renamed From : " << activeLayoutsToRename[newLayoutName]->name() << " TO :: " << newLayoutName; qDebug() << " Active Layout of Type: " << layout->type() << " Is Renamed From : " << activeLayoutsToRename[newLayoutName]->name() << " TO :: " << newLayoutName;
layout->renameLayout(newLayoutName); layout->renameLayout(newLayoutName);
if (layout->type() == Layout::Type::Central) { if (layout->type() == Layout::Type::Central) {
CentralLayout *central = qobject_cast<CentralLayout *>(layout); CentralLayout *central = qobject_cast<CentralLayout *>(layout);
@ -1681,21 +1681,26 @@ void SettingsDialog::updateActiveShares()
for (QHash<const QString, QStringList>::iterator i=currentSharesMap.begin(); i!=currentSharesMap.end(); ++i) { for (QHash<const QString, QStringList>::iterator i=currentSharesMap.begin(); i!=currentSharesMap.end(); ++i) {
SharedLayout *shared = m_corona->layoutManager()->sharedLayout(nameForId(i.key())); SharedLayout *shared = m_corona->layoutManager()->sharedLayout(nameForId(i.key()));
if (shared) { qDebug() << " SHARED :: " << nameForId(i.key());
qDebug() << " SHARED :: " << shared->name(); for (const auto &centralId : i.value()) {
for (const auto &centralId : i.value()) { CentralLayout *central = m_corona->layoutManager()->centralLayout(nameForId(centralId));
CentralLayout *central = m_corona->layoutManager()->centralLayout(nameForId(centralId)); qDebug() << " CENTRAL NAME :: " << nameForId(centralId);
qDebug() << " CENTRAL NAME :: " << nameForId(centralId); if (central) {
if (central) { //! Assign this Central Layout at a different Shared Layout
//! Assign this Central Layout at a different Shared Layout SharedLayout *oldShared = central->sharedLayout();
SharedLayout *oldShared = central->sharedLayout();
if (shared != oldShared) { if (!shared) {
shared->addCentralLayout(central); //Shared not loaded and it must be loaded before proceed
central->setSharedLayout(shared); m_corona->layoutManager()->registerAtSharedLayout(central, nameForId(i.key()));
if (oldShared) { shared = m_corona->layoutManager()->sharedLayout(nameForId(i.key()));
//! CENTRAL layout that changed from one ACTIVESHARED layout to another }
unassign[central] = shared;
} if (shared != oldShared) {
shared->addCentralLayout(central);
central->setSharedLayout(shared);
if (oldShared) {
//! CENTRAL layout that changed from one ACTIVESHARED layout to another
unassign[central] = shared;
} }
} }
} }

Loading…
Cancel
Save