KSaneCore

pagesizeoption.h
1/*
2 * SPDX-FileCopyrightText: 2021 Alexander Stippich <a.stippich@gmx.net>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6
7#ifndef KSANE_PAGESIZE_OPTION_H
8#define KSANE_PAGESIZE_OPTION_H
9
10#include <QList>
11#include <QSizeF>
12
13#include "baseoption.h"
14
15namespace KSaneCore
16{
17
18static const QString PageSizeOptionName = QStringLiteral("KSane::PageSize");
19
20class PageSizeOption : public BaseOption
21{
23
24public:
25 PageSizeOption(BaseOption *optionTopLeftX,
26 BaseOption *optionTopLeftY,
27 BaseOption *optionBottomRightX,
28 BaseOption *optionBottomRightY,
29 BaseOption *optionResolution,
30 BaseOption *optionPageWidth,
31 BaseOption *optionPageHeight);
32
33 QVariant value() const override;
34 QString valueAsString() const override;
35
36 Option::OptionState state() const override;
37 QString name() const override;
38 QString title() const override;
39 QString description() const override;
40 QVariantList valueList() const override;
41 QVariantList internalValueList() const override;
42
43public Q_SLOTS:
44 bool setValue(const QVariant &value) override;
45 void storeOptions();
46 void restoreOptions();
47 void computePageSizes();
48
49private Q_SLOTS:
50 void optionTopLeftXUpdated();
51 void optionTopLeftYUpdated();
52 void optionBottomRightXUpdated();
53 void optionBottomRightYUpdated();
54
55private:
56 struct PageSizeProperties {
57 QString name;
58 QSizeF pageSize;
59 QSizeF wiggleRoom;
60 };
61
62 double ensureMilliMeter(BaseOption *option, double value);
63
64 BaseOption *m_optionTopLeftX;
65 BaseOption *m_optionTopLeftY;
66 BaseOption *m_optionBottomRightX;
67 BaseOption *m_optionBottomRightY;
68 BaseOption *m_optionResolution;
69 BaseOption *m_optionPageWidth;
70 BaseOption *m_optionPageHeight;
71 int m_currentIndex = -1;
72 Option::OptionState m_state = Option::StateDisabled;
73 QList<PageSizeProperties> m_availableSizes;
74 double m_previousCoordinates[4];
75};
76
77} // namespace KSaneCore
78
79#endif // KSANE_PAGESIZE_OPTION_H
OptionState
This enumeration describes the current statue of the value of the option, indicating if this option s...
Definition option.h:46
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri May 2 2025 12:03:20 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.