File indexing completed on 2024-12-08 07:19:38

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Alexander Stippich <a.stippich@gmx.net>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 #include "batchdelayoption.h"
0008 #include <ksanecore_debug.h>
0009 
0010 namespace KSaneCore
0011 {
0012 
0013 BatchDelayOption::BatchDelayOption()
0014 {
0015     m_optionType = Option::TypeInteger;
0016 }
0017 
0018 Option::OptionState BatchDelayOption::state() const
0019 {
0020     return Option::StateActive;
0021     ;
0022 }
0023 
0024 QString BatchDelayOption::name() const
0025 {
0026     return BatchDelayOptionName;
0027 }
0028 
0029 QString BatchDelayOption::title() const
0030 {
0031     return i18n("Batch mode time delay");
0032 }
0033 
0034 QString BatchDelayOption::description() const
0035 {
0036     return i18n("Specify the time delay between each scan when batch mode is enabled.");
0037 }
0038 
0039 QVariant BatchDelayOption::minimumValue() const
0040 {
0041     return 0;
0042 }
0043 
0044 QVariant BatchDelayOption::maximumValue() const
0045 {
0046     return 300;
0047 }
0048 
0049 QVariant BatchDelayOption::stepValue() const
0050 {
0051     return 1;
0052 }
0053 
0054 QVariant BatchDelayOption::value() const
0055 {
0056     return m_delayValue;
0057 }
0058 
0059 QString BatchDelayOption::valueAsString() const
0060 {
0061     return QString::number(m_delayValue);
0062 }
0063 
0064 Option::OptionUnit BatchDelayOption::valueUnit() const
0065 {
0066     return Option::UnitSecond;
0067 }
0068 
0069 bool BatchDelayOption::setValue(const QVariant &val)
0070 {
0071     bool ok;
0072     int newValue = val.toInt(&ok);
0073     if (ok && newValue != m_delayValue) {
0074         m_delayValue = newValue;
0075         Q_EMIT valueChanged(m_delayValue);
0076     }
0077     return ok;
0078 }
0079 
0080 } // NameSpace KSaneCore
0081 
0082 #include "moc_batchdelayoption.cpp"