unload Central(active)layouts to become Shared

pull/5/head
Michail Vourlakos
parent c37f605257
commit 0c4bbd9529

@ -126,45 +126,9 @@ void LayoutManager::unload()
//! Unload all CentralLayouts
while (!m_centralLayouts.isEmpty()) {
CentralLayout *layout = m_centralLayouts.at(0);
m_centralLayouts.removeFirst();
if (m_multipleModeInitialized) {
layout->syncToLayoutFile(true);
}
layout->unloadContainments();
layout->unloadLatteViews();
if (m_multipleModeInitialized) {
clearUnloadedContainmentsFromLinkedFile(layout->unloadedContainmentsIds(), true);
}
delete layout;
unloadCentralLayout(layout);
}
//! Unload all SharedLayouts
//! DEPRECATED as now SharedLayouts are unloading themselves when
//! they have no central layouts assigned to them
/*while (!m_sharedLayouts.isEmpty()) {
SharedLayout *layout = m_sharedLayouts.at(0);
m_sharedLayouts.removeFirst();
unloadSharedLayout(layout);
if (multipleMode) {
layout->syncToLayoutFile(true);
}
layout->unloadContainments();
layout->unloadLatteViews();
if (multipleMode) {
clearUnloadedContainmentsFromLinkedFile(layout->unloadedContainmentsIds(), true);
}
delete layout;
}*/
m_multipleModeInitialized = false;
//! Remove no-needed temp files
@ -181,6 +145,28 @@ void LayoutManager::unload()
file2.remove();
}
void LayoutManager::unloadCentralLayout(CentralLayout *layout)
{
int pos = m_centralLayouts.indexOf(layout);
if (pos>=0) {
CentralLayout *central = m_centralLayouts.takeAt(0);
if (m_multipleModeInitialized) {
central->syncToLayoutFile(true);
}
central->unloadContainments();
central->unloadLatteViews();
if (m_multipleModeInitialized) {
clearUnloadedContainmentsFromLinkedFile(central->unloadedContainmentsIds(), true);
}
delete central;
}
}
void LayoutManager::unloadSharedLayout(SharedLayout *layout)
{
if (m_sharedLayouts.contains(layout)) {

@ -79,6 +79,8 @@ public:
void load();
void loadLayoutOnStartup(QString layoutName);
void unload();
void unloadCentralLayout(CentralLayout *layout);
void hideAllViews();
void pauseLayout(QString layoutName);
void syncLatteViewsToScreens();

@ -1679,6 +1679,14 @@ void SettingsDialog::updateActiveShares()
QHash<CentralLayout *, SharedLayout *> unassign;
//! CENTRAL (active) layouts that will become SHARED must be unloaded first
for (QHash<const QString, QStringList>::iterator i=currentSharesMap.begin(); i!=currentSharesMap.end(); ++i) {
CentralLayout *central = m_corona->layoutManager()->centralLayout(nameForId(i.key()));
if (central) {
m_corona->layoutManager()->unloadCentralLayout(central);
}
}
//! CENTRAL (active) layouts that update their (active) SHARED layouts
//! AND load SHARED layouts that are NOT ACTIVE
for (QHash<const QString, QStringList>::iterator i=currentSharesMap.begin(); i!=currentSharesMap.end(); ++i) {

Loading…
Cancel
Save