cycle properly config views with Meta+A

pull/15/head
Michail Vourlakos 5 years ago
parent 8bfc71fd3e
commit 46760a04de

@ -213,6 +213,8 @@ void CentralLayout::setSharedLayout(SharedLayout *layout)
m_sharedConnections << connect(m_sharedLayout, &Layout::GenericLayout::viewEdgeChanged, this, [this]() {
syncLatteViewsToScreens();
});
m_sharedConnections << connect(m_sharedLayout, &GenericLayout::lastConfigViewForChanged, this, &GenericLayout::lastConfigViewForChanged);
} else {
setSharedLayoutName(QString());
}
@ -231,6 +233,24 @@ void CentralLayout::disconnectSharedConnections()
m_sharedConnections.clear();
}
void CentralLayout::setLastConfigViewFor(Latte::View *view)
{
if (m_sharedLayout) {
m_sharedLayout->setLastConfigViewFor(view);
} else {
GenericLayout::setLastConfigViewFor(view);
}
}
Latte::View *CentralLayout::lastConfigViewFor()
{
if (m_sharedLayout) {
return m_sharedLayout->lastConfigViewFor();
} else {
return GenericLayout::lastConfigViewFor();
}
}
void CentralLayout::loadConfig()
{
m_disableBordersForMaximizedWindows = m_layoutGroup.readEntry("disableBordersForMaximizedWindows", false);
@ -269,16 +289,6 @@ void CentralLayout::addView(Plasma::Containment *containment, bool forceOnPrimar
}
}
bool CentralLayout::configViewIsShown() const
{
bool genericShown = GenericLayout::configViewIsShown();
if (m_sharedLayout) {
return (m_sharedLayout->configViewIsShown() || genericShown);
}
return genericShown;
}
const QStringList CentralLayout::appliedActivities()
{
if (!m_corona) {

@ -74,7 +74,6 @@ public:
void addView(Plasma::Containment *containment, bool forceOnPrimary = false, int explicitScreen = -1, Layout::ViewsMap *occupied = nullptr) override;
void syncLatteViewsToScreens(Layout::ViewsMap *occupiedMap = nullptr) override;
void unloadContainments() override;
bool configViewIsShown() const override;
const QStringList appliedActivities() override;
Types::ViewType latteViewType(uint containmentId) const override;
QList<Latte::View *> latteViews() override;
@ -85,6 +84,9 @@ public:
Layout::Type type() const override;
void setLastConfigViewFor(Latte::View *view) override;
Latte::View *lastConfigViewFor() override;
//! Available edges for specific view in that screen
QList<Plasma::Types::Location> availableEdgesForView(QScreen *scr, Latte::View *forView) const override;
//! All free edges in that screen

@ -152,17 +152,6 @@ void GenericLayout::setBlockAutomaticLatteViewCreation(bool block)
m_blockAutomaticLatteViewCreation = block;
}
bool GenericLayout::configViewIsShown() const
{
for (const auto view : m_latteViews) {
if (view && view->settingsWindowIsShown()) {
return true;
}
}
return false;
}
bool GenericLayout::isActive() const
{
if (!m_corona) {
@ -378,11 +367,6 @@ Latte::View *GenericLayout::highestPriorityView()
Latte::View *GenericLayout::lastConfigViewFor()
{
if (!latteViews().contains(m_lastConfigViewFor)) {
m_lastConfigViewFor = nullptr;
return nullptr;
}
return m_lastConfigViewFor;
}

@ -90,8 +90,6 @@ public:
bool isInternalContainment(Plasma::Applet *applet) const;
Plasma::Containment *internalContainmentOf(Plasma::Applet *applet) const;
virtual bool configViewIsShown() const;
virtual int viewsCount(int screen) const;
virtual int viewsCount(QScreen *screen) const;
virtual int viewsCount() const;

@ -189,7 +189,7 @@ int SharedLayout::viewsCount() const
QList<Plasma::Types::Location> SharedLayout::availableEdgesForView(QScreen *scr, Latte::View *forView) const
{
/* using Plasma::Types;
/* using Plasma::Types;
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
Types::TopEdge, Types::RightEdge};
@ -202,7 +202,7 @@ QList<Plasma::Types::Location> SharedLayout::availableEdgesForView(QScreen *scr,
QList<Plasma::Types::Location> SharedLayout::freeEdges(QScreen *scr) const
{
/* using Plasma::Types;
/* using Plasma::Types;
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
Types::TopEdge, Types::RightEdge};
@ -221,7 +221,7 @@ QList<Plasma::Types::Location> SharedLayout::freeEdges(QScreen *scr) const
QList<Plasma::Types::Location> SharedLayout::freeEdges(int screen) const
{
/* using Plasma::Types;
/* using Plasma::Types;
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
Types::TopEdge, Types::RightEdge};
@ -238,28 +238,6 @@ QList<Plasma::Types::Location> SharedLayout::freeEdges(int screen) const
return Layout::GenericLayout::freeEdges(screen);
}
void SharedLayout::setLastConfigViewFor(Latte::View *view)
{
CentralLayout *current = currentCentralLayout();
if (current) {
return current->setLastConfigViewFor(view);
}
return GenericLayout::setLastConfigViewFor(view);
}
Latte::View *SharedLayout::lastConfigViewFor()
{
CentralLayout *current = currentCentralLayout();
if (current) {
return current->lastConfigViewFor();
}
return GenericLayout::lastConfigViewFor();
}
QList<Latte::View *> SharedLayout::sortedLatteViews(QList<Latte::View *> views)
{
CentralLayout *current = currentCentralLayout();

@ -60,9 +60,6 @@ public:
Layout::Type type() const override;
void setLastConfigViewFor(Latte::View *view) override;
Latte::View *lastConfigViewFor() override;
//! Available edges for specific view in that screen
QList<Plasma::Types::Location> availableEdgesForView(QScreen *scr, Latte::View *forView) const override;
//! All free edges in that screen

@ -262,7 +262,7 @@ void GlobalShortcuts::activateLauncherMenu()
//! delay the execution in order to show first the view
QTimer::singleShot(APPLETEXECUTIONDELAY, [this, highestPriorityView]() {
highestPriorityView->extendedInterface()->toggleAppletExpanded(highestPriorityView->extendedInterface()->applicationLauncherId());
highestPriorityView->visibility()->removeBlockHidingEvent(SHORTCUTBLOCKHIDINGTYPE);
highestPriorityView->visibility()->removeBlockHidingEvent(SHORTCUTBLOCKHIDINGTYPE);
});
} else {
highestPriorityView->extendedInterface()->toggleAppletExpanded(highestPriorityView->extendedInterface()->applicationLauncherId());
@ -333,7 +333,7 @@ bool GlobalShortcuts::activateEntryForView(Latte::View *view, int index, Qt::Key
bool executed = ((!view->latteTasksArePresent() && view->tasksPresent() &&
activatePlasmaTaskManager(view, index, modifier, &delayed))
|| activateLatteEntry(view, index, modifier, &delayed));
|| activateLatteEntry(view, index, modifier, &delayed));
if (executed) {
if (!m_hideViews.contains(view)) {
@ -525,7 +525,7 @@ void GlobalShortcuts::showSettings()
if (sortedViews.count() > 0) {
int openSettings = -1;
//! check if there is a view with opened settings window
//! find last view that showed its config view
for (int i = 0; i < sortedViews.size(); ++i) {
if (sortedViews[i] == currentLayout->lastConfigViewFor()) {
openSettings = i;
@ -534,7 +534,8 @@ void GlobalShortcuts::showSettings()
}
if (openSettings >= 0 && sortedViews.count() > 1) {
openSettings = currentLayout->configViewIsShown() ? openSettings + 1 : openSettings;
//! check if there is a view with opened settings window
openSettings = sortedViews[openSettings]->settingsWindowIsShown() ? openSettings + 1 : openSettings;
if (openSettings >= sortedViews.size()) {
openSettings = 0;

@ -226,7 +226,6 @@ public:
QStringList activities() const;
void setActivities(const QStringList &ids);
bool settingsWindowIsShown();
void showSettingsWindow();

Loading…
Cancel
Save