KSaneCore

option.cpp
1/*
2 * SPDX-FileCopyrightText: 2014 Gregor Mitsch : port to KDE5 frameworks
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6
7#include "option.h"
8#include "baseoption.h"
9#include "option_p.h"
10
11#include <ksanecore_debug.h>
12
13namespace KSaneCore
14{
15
16Option::Option(QObject *parent)
17 : QObject(parent)
18 , d(std::make_unique<OptionPrivate>())
19{
20}
21
22Option::~Option() = default;
23
24Option::OptionState Option::state() const
25{
26 if (d->option != nullptr) {
27 return d->option->state();
28 } else {
29 return StateDisabled;
30 }
31}
32
33QString Option::name() const
34{
35 if (d->option != nullptr) {
36 return d->option->name();
37 } else {
38 return QString();
39 }
40}
41
42QString Option::title() const
43{
44 if (d->option != nullptr) {
45 return d->option->title();
46 } else {
47 return QString();
48 }
49}
50
51QString Option::description() const
52{
53 if (d->option != nullptr) {
54 return d->option->description();
55 } else {
56 return QString();
57 }
58}
59
60Option::OptionType Option::type() const
61{
62 if (d->option != nullptr) {
63 return d->option->type();
64 } else {
65 return TypeDetectFail;
66 }
67}
68
69QVariant Option::minimumValue() const
70{
71 if (d->option != nullptr) {
72 return d->option->minimumValue();
73 } else {
74 return QVariant();
75 }
76}
77
78QVariant Option::maximumValue() const
79{
80 if (d->option != nullptr) {
81 return d->option->maximumValue();
82 } else {
83 return QVariant();
84 }
85}
86
87QVariant Option::stepValue() const
88{
89 if (d->option != nullptr) {
90 return d->option->stepValue();
91 } else {
92 return QVariant();
93 }
94}
95
96QVariantList Option::valueList() const
97{
98 if (d->option != nullptr) {
99 return d->option->valueList();
100 } else {
101 return QVariantList();
102 }
103}
104
105QVariantList Option::internalValueList() const
106{
107 if (d->option != nullptr) {
108 return d->option->internalValueList();
109 } else {
110 return QVariantList();
111 }
112}
113
114QVariant Option::value() const
115{
116 if (d->option != nullptr) {
117 return d->option->value();
118 } else {
119 return QVariant();
120 }
121}
122
123Option::OptionUnit Option::valueUnit() const
124{
125 if (d->option != nullptr) {
126 return d->option->valueUnit();
127 } else {
128 return UnitNone;
129 }
130}
131
132int Option::valueSize() const
133{
134 if (d->option != nullptr) {
135 return d->option->valueSize();
136 } else {
137 return 0;
138 }
139}
140
141bool Option::setValue(const QVariant &value)
142{
143 if (d->option != nullptr) {
144 return d->option->setValue(value);
145 } else {
146 return false;
147 }
148}
149
150bool Option::storeCurrentData()
151{
152 if (d->option != nullptr) {
153 return d->option->storeCurrentData();
154 } else {
155 return false;
156 }
157}
158
159bool Option::restoreSavedData()
160{
161 if (d->option != nullptr) {
162 return d->option->restoreSavedData();
163 } else {
164 return false;
165 }
166}
167
168} // namespace KSaneCore
169
170#include "moc_option.cpp"
OptionType
This enumeration describes the type of the option.
Definition option.h:34
OptionState
This enumeration describes the current statue of the value of the option, indicating if this option s...
Definition option.h:46
OptionUnit
This enumeration describes the unit of the value of the option, if any.
Definition option.h:40
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:54:20 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.