KSaneCore

batchmodeoption.cpp
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#include "batchmodeoption.h"
8
9#include <ksanecore_debug.h>
10
11namespace KSaneCore
12{
13
14BatchModeOption::BatchModeOption()
15{
16 m_optionType = Option::TypeBool;
17}
18
19Option::OptionState BatchModeOption::state() const
20{
21 return Option::StateActive;
22}
23
24QString BatchModeOption::name() const
25{
26 return BatchModeOptionName;
27}
28
29QString BatchModeOption::title() const
30{
31 return i18n("Batch mode with time delay");
32}
33
34QString BatchModeOption::description() const
35{
36 return i18n("Enables batch mode scanning. Continues scanning after a delay until canceled.");
37}
38
39bool BatchModeOption::setValue(const QVariant &value)
40{
41 const bool toggled = value.toBool();
42
43 if (m_checked != toggled) {
44 m_checked = toggled;
45 Q_EMIT valueChanged(m_checked);
46 }
47 return true;
48}
49
50QVariant BatchModeOption::value() const
51{
52 return m_checked;
53}
54
55QString BatchModeOption::valueAsString() const
56{
57 if (state() == Option::StateHidden) {
58 return QString();
59 }
60 if (m_checked) {
61 return QStringLiteral("true");
62 } else {
63 return QStringLiteral("false");
64 }
65}
66
67} // NameSpace KSaneCore
68
69#include "moc_batchmodeoption.cpp"
OptionState
This enumeration describes the current statue of the value of the option, indicating if this option s...
Definition option.h:46
QString i18n(const char *text, const TYPE &arg...)
Q_EMITQ_EMIT
bool toBool() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:49:00 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.