File indexing completed on 2024-12-01 07:26:15
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 "invertoption.h" 0008 0009 #include <ksanecore_debug.h> 0010 0011 namespace KSaneCore 0012 { 0013 0014 InvertOption::InvertOption() 0015 { 0016 m_optionType = Option::TypeBool; 0017 } 0018 0019 bool InvertOption::setValue(const QVariant &value) 0020 { 0021 if (value.canConvert<bool>()) { 0022 if (m_checked != value.toBool()) { 0023 m_checked = value.toBool(); 0024 Q_EMIT valueChanged(m_checked); 0025 } 0026 return true; 0027 } else { 0028 return false; 0029 } 0030 } 0031 0032 QVariant InvertOption::value() const 0033 { 0034 return m_checked; 0035 } 0036 0037 QString InvertOption::valueAsString() const 0038 { 0039 if (m_checked) { 0040 return QStringLiteral("true"); 0041 } else { 0042 return QStringLiteral("false"); 0043 } 0044 } 0045 0046 Option::OptionState InvertOption::state() const 0047 { 0048 return Option::StateActive; 0049 } 0050 0051 QString InvertOption::name() const 0052 { 0053 return InvertColorsOptionName; 0054 } 0055 0056 QString InvertOption::title() const 0057 { 0058 return i18n("Invert colors"); 0059 } 0060 0061 QString InvertOption::description() const 0062 { 0063 return i18n("Invert the colors of the scanned image."); 0064 } 0065 0066 } // namespace KSaneCore 0067 0068 #include "moc_invertoption.cpp"