File indexing completed on 2024-12-01 07:26:16

0001 /*
0002  * SPDX-FileCopyrightText: 2009 Kare Sars <kare dot sars at iki dot fi>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 #ifndef KSANE_VALUELIST_OPTION_H
0008 #define KSANE_VALUELIST_OPTION_H
0009 
0010 #include "baseoption.h"
0011 
0012 namespace KSaneCore
0013 {
0014 
0015 class ListOption : public BaseOption
0016 {
0017     Q_OBJECT
0018 
0019 public:
0020     ListOption(const SANE_Handle handle, const int index);
0021 
0022     void readValue() override;
0023     void readOption() override;
0024 
0025     QVariant minimumValue() const override;
0026     QVariant value() const override;
0027     QString valueAsString() const override;
0028     QVariantList valueList() const override;
0029     QVariantList internalValueList() const override;
0030     Option::OptionState state() const override;
0031 
0032 public Q_SLOTS:
0033     bool setValue(const QVariant &value) override;
0034 
0035 private:
0036     bool setValue(double value);
0037     bool setValue(const QString &value);
0038     void countEntries();
0039 
0040     QVariant m_currentValue;
0041     int m_entriesCount = 0;
0042 };
0043 
0044 } // namespace KSaneCore
0045 
0046 #endif // KSANE_VALUELIST_OPTION_H