add shortcuts for layout

pull/4/head
Michail Vourlakos 6 years ago
parent ffc1669c67
commit 62f396e86f

@ -11,6 +11,7 @@ set(lattedock-app_SRCS
schemecolors.cpp
screenpool.cpp
layout/layout.cpp
layout/shortcuts.cpp
package/lattepackage.cpp
plasma/extended/screenpool.cpp
plasma/extended/theme.cpp

@ -21,6 +21,7 @@
#include "layout.h"
// local
#include "shortcuts.h"
#include "../importer.h"
#include "../lattecorona.h"
#include "../layoutmanager.h"
@ -67,6 +68,10 @@ Layout::Layout(QObject *parent, QString layoutFile, QString assignedName)
Layout::~Layout()
{
if (m_shortcuts) {
m_shortcuts->deleteLater();
}
if (!m_layoutFile.isEmpty()) {
m_layoutGroup.sync();
}
@ -181,8 +186,16 @@ void Layout::init()
void Layout::initToCorona(Latte::Corona *corona)
{
if (m_corona) {
return;
}
m_corona = corona;
if (!m_shortcuts) {
m_shortcuts = new LayoutPart::Shortcuts(this);
}
foreach (auto containment, m_corona->containments()) {
if (m_corona->layoutManager()->memoryUsage() == Types::SingleLayout) {
addContainment(containment);

@ -23,6 +23,7 @@
// Qt
#include <QObject>
#include <QPointer>
#include <QScreen>
// KDE
@ -41,6 +42,9 @@ class Types;
namespace Latte {
class Corona;
class View;
namespace LayoutPart {
class Shortcuts;
}
}
namespace Latte {
@ -242,6 +246,8 @@ private:
QStringList m_unloadedContainmentsIds;
Latte::Corona *m_corona{nullptr};
QPointer<Latte::LayoutPart::Shortcuts> m_shortcuts;
KConfigGroup m_layoutGroup;
QList<Plasma::Containment *> m_containments;

@ -0,0 +1,36 @@
/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "shortcuts.h"
namespace Latte {
namespace LayoutPart {
Shortcuts::Shortcuts(QObject *parent)
: QObject(parent)
{
}
Shortcuts::~Shortcuts()
{
}
}
}

@ -0,0 +1,47 @@
/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LAYOUTSHORTCUTS_H
#define LAYOUTSHORTCUTS_H
// Qt
#include <QObject>
// KDE
#include <KConfigGroup>
#include <KSharedConfig>
namespace Latte {
namespace LayoutPart {
class Shortcuts: public QObject {
Q_OBJECT
public:
Shortcuts(QObject *parent);
~Shortcuts() override;
private:
};
}
}
#endif
Loading…
Cancel
Save