Krita Source Code Documentation
Loading...
Searching...
No Matches
GuidesConfig.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024 Grum999 <grum999@grum.fr>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#include "GuidesConfig.h"
7
8#include <QDomDocument>
9#include <QDomElement>
10
11#include "kis_guides_config.h"
12
17
19 : QObject(0)
20 , d(new Private)
21{
23}
24
26 : QObject(parent)
27 , d(new Private)
28{
30}
31
33{
34 delete d;
35}
36
37bool GuidesConfig::operator==(const GuidesConfig &other) const
38{
39 return (d->guidesConfig == other.d->guidesConfig);
40}
41
42bool GuidesConfig::operator!=(const GuidesConfig &other) const
43{
44 return !(operator==(other));
45}
46
47QColor GuidesConfig::color() const
48{
49 return d->guidesConfig->guidesColor();
50}
51
52void GuidesConfig::setColor(const QColor &color) const
53{
55}
56
58{
61 return "dashed";
62 }
64 return "dotted";
65 }
66 return "solid";
67}
68
83
85{
86 return d->guidesConfig->hasGuides();
87}
88
89bool GuidesConfig::hasSamePositionAs(const GuidesConfig &guideConfig) const
90{
91 return d->guidesConfig->hasSamePositionAs(guideConfig.guidesConfig());
92}
93
95{
96 return d->guidesConfig->showGuides();
97}
98
103
104bool GuidesConfig::fromXml(const QString &xmlContent) const
105{
106 QDomDocument doc = QDomDocument();
107
108 if(doc.setContent(xmlContent)) {
109 return d->guidesConfig->loadFromXml(doc.documentElement());
110 }
111
112 return false;
113}
114
115QString GuidesConfig::toXml() const
116{
117 QDomDocument doc = QDomDocument();
118 QDomElement elt = d->guidesConfig->saveToXml(doc, "guides");
119 doc.appendChild(elt);
120 return doc.toString(2);
121}
122
127
129{
130 return d->guidesConfig->lockGuides();
131}
132
133void GuidesConfig::setLocked(const bool locked)
134{
136}
137
139{
140 return d->guidesConfig->snapToGuides();
141}
142
144{
146}
147
152
157
162
167
float value(const T *src, size_t ch)
bool hasSamePositionAs(const GuidesConfig &guideConfig) const
indicate if position from current guides configuration match positions from another guides configurat...
QString toXml() const
Save guides definition as an XML document.
void setColor(const QColor &color) const
Define guides color.
QList< qreal > horizontalGuides() const
The horizontal guides.
bool operator!=(const GuidesConfig &other) const
QColor color() const
Guides color.
bool fromXml(const QString &xmlContent) const
Load guides definition from an XML document.
void removeAllGuides()
Remove all guides.
void setVerticalGuides(const QList< qreal > &lines)
Set the vertical guides.
bool operator==(const GuidesConfig &other) const
void setLocked(const bool value)
Set guides lock status.
bool hasGuides() const
indicate if there's guides defined
void setVisible(const bool value)
Set guides visibility status.
QString lineType() const
Guides line type.
KisGuidesConfig guidesConfig() const
GuidesConfig(KisGuidesConfig *guidesConfig)
bool visible() const
Returns guides visibility status.
bool snap() const
Returns guide snap status.
void setHorizontalGuides(const QList< qreal > &lines)
Set the horizontal guides.
QList< qreal > verticalGuides() const
The vertical guides.
~GuidesConfig() override
bool locked() const
Returns guide lock status.
void setSnap(const bool value)
Set guides snap status.
void setLineType(const QString &lineType)
Define guides lines type.
Private * d
void setHorizontalGuideLines(const QList< qreal > &lines)
Set the positions of the horizontal guide lines.
void setShowGuides(bool value)
void setSnapToGuides(bool value)
void setGuidesColor(const QColor &value)
const QList< qreal > & verticalGuideLines() const
Returns the list of vertical guide lines.
void setLockGuides(bool value)
QDomElement saveToXml(QDomDocument &doc, const QString &tag) const
bool loadFromXml(const QDomElement &parent)
void setVerticalGuideLines(const QList< qreal > &lines)
Set the positions of the vertical guide lines.
bool hasSamePositionAs(const KisGuidesConfig &rhs) const
const QList< qreal > & horizontalGuideLines() const
Returns the list of horizontal guide lines.
LineTypeInternal guidesLineType
void setGuidesLineType(LineTypeInternal value)
KisGuidesConfig * guidesConfig