1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
/*
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*/
};
View();
View(View &&o);
View(const View &o);
View(const QString &newid, const QString &newname);
//! View data
bool isActive{false};
bool onPrimary{true};
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};
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 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
|