1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-06 21:18:11 +03:00
latte-dock/app/data/viewdata.h
Michail Vourlakos 60095bba3b fix #96,FEATURE:AllScreens and AllSecondaryScreens
--This is a HUGE FEATURE and so important for multi-screens
users. It is introduced as one single commit because it
reimplements plenty of infrastructure changes and it will
be easier to identify newly introduced bugs.
--Users can now choose for their docks and panels to belong
at various screen groups. The first two screen groups introduced
are AllScreens and AllSecondayScreens. In the future it might
be possible to provide CustomScreensGroup that the user will
be able to define specific screens in which a dock or panel
should be always present.
--Current solution specifies an Original dock or panel and clones/copies
itself automatically to other screens. So docks and panels in other screens
are just real docks and panels that reference themselves to original
docks and panels.
--Clones are destroyed during layout startup and are automaticaly
recreated. It is suggested to export your layouts through the
official Layouts Editor in order to share them because in that case
clones are not included in the new generated layout file. If in any
case you do not this and you share your layout with any previous
versions then your clones will just appear as separate docks and
panels that belong to specific screens.
--Automatic syncing was introduced in order to keep up-to-date
the configuration of Original docks and panels with their referenced
Clones.
--Automatic syncing currently works for all docks and panels settings,
for all normal applets configurations and for all subcontaiments
configuration such as systrays.
--Automatic syncing does not work for applets inside subcontainments
such as Group Plasmoid. In such case it is suggested to configure
your applets inside your Group Plasmoid in the original dock or panel
and afterwards to trigger a recreation for the relevant clones
--Manual recreation of clones is easily possible by just choosing
the dock or panel to be OnPrimary or OnSpecificScreen and rechoosing
afterwards the AllScreensGroup or AllSecondaryScreensGroup
2022-01-16 13:38:13 +02:00

103 lines
2.3 KiB
C++

/*
SPDX-FileCopyrightText: 2021 Michail Vourlakos <mvourlakos@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef VIEWDATA_H
#define VIEWDATA_H
// local
#include <coretypes.h>
#include "genericdata.h"
#include "../screenpool.h"
// Qt
#include <QMetaType>
#include <QString>
// Plasma
#include <Plasma>
namespace Latte {
namespace Data {
class View : public Generic
{
public:
enum State {
IsInvalid = -1,
IsCreated = 0,
OriginFromViewTemplate, /*used for view templates files*/
OriginFromLayout /*used from duplicate, copy, move view functions*/
};
static const int ISCLONEDNULL;
View();
View(View &&o);
View(const View &o);
View(const QString &newid, const QString &newname);
//! View data
bool isActive{false};
bool onPrimary{true};
int isClonedFrom{ISCLONEDNULL};
int screen{Latte::ScreenPool::FIRSTSCREENID};
int screenEdgeMargin{0};
float maxLength{1.0};
Plasma::Types::Location edge{Plasma::Types::BottomEdge};
Latte::Types::Alignment alignment{Latte::Types::Center};
Latte::Types::ScreensGroup screensGroup{Latte::Types::SingleScreenGroup};
GenericTable<Data::Generic> subcontainments;
int errors{0};
int warnings{0};
//! View sub-states
bool isMoveOrigin{false};
bool isMoveDestination{false};
bool isValid() const;
bool isCreated() const;
bool isOriginal() const;
bool isCloned() const;
bool hasViewTemplateOrigin() const;
bool hasLayoutOrigin() const;
bool hasSubContainment(const QString &subId) const;
bool hasErrors() const;
bool hasWarnings() const;
bool isHorizontal() const;
bool isVertical() const;
QString originFile() const;
QString originLayout() const;
QString originView() const;
View::State state() const;
void setState(View::State state, QString file = QString(), QString layout = QString(), QString view = QString());
//! Operators
View &operator=(const View &rhs);
View &operator=(View &&rhs);
bool operator==(const View &rhs) const;
bool operator!=(const View &rhs) const;
operator QString() const;
protected:
View::State m_state{IsInvalid};
//! Origin Data
QString m_originFile;
QString m_originLayout;
QString m_originView;
};
}
}
Q_DECLARE_METATYPE(Latte::Data::View)
#endif